You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2019/11/30 23:48:35 UTC

[incubator-datasketches-java] branch Cleanup created (now c0819b9)

This is an automated email from the ASF dual-hosted git repository.

leerho pushed a change to branch Cleanup
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git.


      at c0819b9  Adding finals to many test files.

This branch includes the following new commits:

     new 71133e1  Mostly code cleanup
     new c0819b9  Adding finals to many test files.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[incubator-datasketches-java] 02/02: Adding finals to many test files.

Posted by le...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch Cleanup
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git

commit c0819b9d5e1ca4f01d4b78d10e14ccead3cf63a3
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Sat Nov 30 15:46:52 2019 -0800

    Adding finals to many test files.
    
    Finally decided to omit test files from checkstyle checking.
---
 .../org/apache/datasketches/cpc/BitMatrix.java     |   0
 .../cpc/CompressionCharacterization.java           |   5 +
 .../apache/datasketches/cpc/MergingValidation.java |  57 +++----
 .../datasketches/cpc/QuickMergingValidation.java   |  69 +++++----
 .../datasketches/cpc/StreamingValidation.java      |  41 ++---
 .../java/org/apache/datasketches/cpc/TestUtil.java |  18 +--
 .../apache/datasketches/cpc/CpcCBinariesTest.java  | 166 ++++++++++-----------
 .../datasketches/cpc/CpcCompressionTest.java       |  44 +++---
 .../org/apache/datasketches/cpc/CpcSketchTest.java |  51 ++++---
 .../{LzTzSpeedTesting.java => LzTzSpeedTest.java}  |   5 +-
 .../org/apache/datasketches/cpc/TestAllTest.java   |  20 +--
 ...ressTestHashMap.java => HashMapStressTest.java} |  24 +--
 .../datasketches/theta/BackwardConversions.java    |  36 ++---
 .../org/apache/datasketches/tuple/TestUtil.java    |  14 +-
 .../tuple/aninteger/EngagementTest.java            |   2 +-
 tools/SketchesCheckstyle.xml                       |   6 +-
 16 files changed, 291 insertions(+), 267 deletions(-)

diff --git a/src/test/java/org/apache/datasketches/cpc/BitMatrix.java b/src/main/java/org/apache/datasketches/cpc/BitMatrix.java
similarity index 100%
rename from src/test/java/org/apache/datasketches/cpc/BitMatrix.java
rename to src/main/java/org/apache/datasketches/cpc/BitMatrix.java
diff --git a/src/test/java/org/apache/datasketches/cpc/CompressionCharacterization.java b/src/main/java/org/apache/datasketches/cpc/CompressionCharacterization.java
similarity index 97%
rename from src/test/java/org/apache/datasketches/cpc/CompressionCharacterization.java
rename to src/main/java/org/apache/datasketches/cpc/CompressionCharacterization.java
index 10c8f63..dd61744 100644
--- a/src/test/java/org/apache/datasketches/cpc/CompressionCharacterization.java
+++ b/src/main/java/org/apache/datasketches/cpc/CompressionCharacterization.java
@@ -34,6 +34,11 @@ import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.WritableMemory;
 
 /**
+ * This code is used both by unit tests, for short running tests,
+ * and by the characterization repository for longer running, more exhaustive testing. To be
+ * accessible for both, this code is part of the main hierarchy. It is not used during normal
+ * production runtime.
+ *
  * @author Lee Rhodes
  * @author Kevin Lang
  */
diff --git a/src/test/java/org/apache/datasketches/cpc/MergingValidation.java b/src/main/java/org/apache/datasketches/cpc/MergingValidation.java
similarity index 75%
rename from src/test/java/org/apache/datasketches/cpc/MergingValidation.java
rename to src/main/java/org/apache/datasketches/cpc/MergingValidation.java
index fae641a..ced5cea 100644
--- a/src/test/java/org/apache/datasketches/cpc/MergingValidation.java
+++ b/src/main/java/org/apache/datasketches/cpc/MergingValidation.java
@@ -29,6 +29,11 @@ import java.io.PrintStream;
 import java.io.PrintWriter;
 
 /**
+ * This code is used both by unit tests, for short running tests,
+ * and by the characterization repository for longer running, more exhaustive testing. To be
+ * accessible for both, this code is part of the main hierarchy. It is not used during normal
+ * production runtime.
+ *
  * @author Lee Rhodes
  * @author Kevin Lang
  */
@@ -48,8 +53,8 @@ public class MergingValidation {
   private PrintStream printStream;
   private PrintWriter printWriter;
 
-  public MergingValidation(int lgMinK, int lgMaxK, int lgMulK, int uPPO, int incLgK,
-      PrintStream pS, PrintWriter pW) {
+  public MergingValidation(final int lgMinK, final int lgMaxK, final int lgMulK, final int uPPO,
+      final int incLgK, final PrintStream pS, final PrintWriter pW) {
     this.lgMinK = lgMinK;
     this.lgMaxK = lgMaxK;
     this.lgMulK = lgMulK;
@@ -97,18 +102,18 @@ public class MergingValidation {
 
   private void testMerging(final int lgKm, final int lgKa, final int lgKb, final long nA,
       final long nB) {
-    CpcUnion ugM = new CpcUnion(lgKm);
+    final CpcUnion ugM = new CpcUnion(lgKm);
 
-//    int lgKd = ((nA != 0) && (lgKa < lgKm)) ? lgKa : lgKm;
-//    lgKd =     ((nB != 0) && (lgKb < lgKd)) ? lgKb : lgKd;
+    // int lgKd = ((nA != 0) && (lgKa < lgKm)) ? lgKa : lgKm;
+    // lgKd =     ((nB != 0) && (lgKb < lgKd)) ? lgKb : lgKd;
     int lgKd = lgKm;
     if ((lgKa < lgKd) && (nA != 0)) { lgKd = lgKa; } //d = min(a,m) : m
     if ((lgKb < lgKd) && (nB != 0)) { lgKd = lgKb; } //d = min(b,d) : d
 
-    CpcSketch skD = new CpcSketch(lgKd); // direct sketch, updated with both streams
+    final CpcSketch skD = new CpcSketch(lgKd); // direct sketch, updated with both streams
 
-    CpcSketch skA = new CpcSketch(lgKa);
-    CpcSketch skB = new CpcSketch(lgKb);
+    final CpcSketch skA = new CpcSketch(lgKa);
+    final CpcSketch skB = new CpcSketch(lgKb);
 
     for (long i = 0; i < nA; i++) {
       final long in = (vIn += iGoldenU64);
@@ -129,16 +134,16 @@ public class MergingValidation {
 
     final long cM = ugM.getNumCoupons();//countBitsSetInMatrix(matrixM);
     final long cD = skD.numCoupons;
-    Flavor flavorD = skD.getFlavor();
-    Flavor flavorA = skA.getFlavor();
-    Flavor flavorB = skB.getFlavor();
-    String dOff = Integer.toString(skD.windowOffset);
-    String aOff = Integer.toString(skA.windowOffset);
-    String bOff = Integer.toString(skB.windowOffset);
-    String flavorDoff = flavorD + String.format("%2s",dOff);
-    String flavorAoff = flavorA + String.format("%2s",aOff);
-    String flavorBoff = flavorB + String.format("%2s",bOff);
-    double iconEstD = getIconEstimate(lgKd, cD);
+    final Flavor flavorD = skD.getFlavor();
+    final Flavor flavorA = skA.getFlavor();
+    final Flavor flavorB = skB.getFlavor();
+    final String dOff = Integer.toString(skD.windowOffset);
+    final String aOff = Integer.toString(skA.windowOffset);
+    final String bOff = Integer.toString(skB.windowOffset);
+    final String flavorDoff = flavorD + String.format("%2s",dOff);
+    final String flavorAoff = flavorA + String.format("%2s",aOff);
+    final String flavorBoff = flavorB + String.format("%2s",bOff);
+    final double iconEstD = getIconEstimate(lgKd, cD);
 
     rtAssert(finalLgKm <= lgKm);
     rtAssert(cM <= (skA.numCoupons + skB.numCoupons));
@@ -148,8 +153,8 @@ public class MergingValidation {
     final long[] matrixD = CpcUtil.bitMatrixOfSketch(skD);
     rtAssertEquals(matrixM, matrixD);
 
-    CpcSketch skR = ugM.getResult();
-    double iconEstR = getIconEstimate(skR.lgK, skR.numCoupons);
+    final CpcSketch skR = ugM.getResult();
+    final double iconEstR = getIconEstimate(skR.lgK, skR.numCoupons);
     rtAssertEquals(iconEstD, iconEstR, 0.0);
     rtAssert(TestUtil.specialEquals(skD, skR, false, true));
 
@@ -158,13 +163,13 @@ public class MergingValidation {
         skA.numCoupons, skB.numCoupons, cD, iconEstR);
   }
 
-  private void printf(String format, Object ... args) {
+  private void printf(final String format, final Object ... args) {
     if (printStream != null) { printStream.printf(format, args); }
     if (printWriter != null) { printWriter.printf(format, args); }
   }
 
   private void assembleFormats() {
-    String[][] assy = {
+    final String[][] assy = {
         {"lgKm",        "%4s",  "%4d"},
         {"lgKa",        "%4s",  "%4d"},
         {"lgKb",        "%4s",  "%4d"},
@@ -180,13 +185,13 @@ public class MergingValidation {
         {"Coupons_fd",  "%9s",  "%9d"},
         {"IconEst_dr",  "%12s", "%,12.0f"}
     };
-    int cols = assy.length;
+    final int cols = assy.length;
     hStrArr = new String[cols];
-    StringBuilder headerFmt = new StringBuilder();
-    StringBuilder dataFmt = new StringBuilder();
+    final StringBuilder headerFmt = new StringBuilder();
+    final StringBuilder dataFmt = new StringBuilder();
     headerFmt.append("\nMerging Validation\n");
     for (int i = 0; i < cols; i++) {
-      hStrArr[i] =assy[i][0];
+      hStrArr[i] = assy[i][0];
       headerFmt.append(assy[i][1]);
       headerFmt.append((i < (cols - 1)) ? "\t" : "\n");
       dataFmt.append(assy[i][2]);
diff --git a/src/test/java/org/apache/datasketches/cpc/QuickMergingValidation.java b/src/main/java/org/apache/datasketches/cpc/QuickMergingValidation.java
similarity index 66%
rename from src/test/java/org/apache/datasketches/cpc/QuickMergingValidation.java
rename to src/main/java/org/apache/datasketches/cpc/QuickMergingValidation.java
index 9e1dc51..022dc88 100644
--- a/src/test/java/org/apache/datasketches/cpc/QuickMergingValidation.java
+++ b/src/main/java/org/apache/datasketches/cpc/QuickMergingValidation.java
@@ -26,8 +26,13 @@ import java.io.PrintStream;
 import java.io.PrintWriter;
 
 /**
- * This test of merging is the equal K case and is less exhaustive than TestAlltest
- * but is more practical for large values of K.
+ * This code is used both by unit tests, for short running tests,
+ * and by the characterization repository for longer running, more exhaustive testing. To be
+ * accessible for both, this code is part of the main hierarchy. It is not used during normal
+ * production runtime.
+ *
+ * <p>This test of merging is the equal K case and is less exhaustive than TestAlltest
+ * but is more practical for large values of K.</p>
  *
  * @author Lee Rhodes
  * @author Kevin Lang
@@ -67,10 +72,10 @@ public class QuickMergingValidation {
     }
   }
 
-  private void multiQuickTest(int lgK) {
-    int k = 1 << lgK;
-    int[] targetC = new int[] { 0, 1, ((3 * k) / 32) - 1, k / 3, k, (7 * k) / 2 };
-    int len = targetC.length;
+  private void multiQuickTest(final int lgK) {
+    final int k = 1 << lgK;
+    final int[] targetC = new int[] { 0, 1, ((3 * k) / 32) - 1, k / 3, k, (7 * k) / 2 };
+    final int len = targetC.length;
     for (int i = 0; i < len; i++) {
       for (int j = 0; j < len; j++) {
         quickTest(lgK, targetC[i], targetC[j]);
@@ -79,11 +84,11 @@ public class QuickMergingValidation {
   }
 
   void quickTest(final int lgK, final long cA, final long cB) {
-    CpcSketch skA = new CpcSketch(lgK);
-    CpcSketch skB = new CpcSketch(lgK);
-    CpcSketch skD = new CpcSketch(lgK); // direct sketch
+    final CpcSketch skA = new CpcSketch(lgK);
+    final CpcSketch skB = new CpcSketch(lgK);
+    final CpcSketch skD = new CpcSketch(lgK); // direct sketch
 
-    long t0, t1, t2, t3, t4, t5;
+    final long t0, t1, t2, t3, t4, t5;
 
     t0 = System.nanoTime();
     while (skA.numCoupons < cA) {
@@ -99,44 +104,44 @@ public class QuickMergingValidation {
     }
     t2 = System.nanoTime();
 
-    CpcUnion ugM = new CpcUnion(lgK);
+    final CpcUnion ugM = new CpcUnion(lgK);
     ugM.update(skA);
     t3 = System.nanoTime();
 
     ugM.update(skB);
     t4 = System.nanoTime();
 
-    CpcSketch skR = ugM.getResult();
+    final CpcSketch skR = ugM.getResult();
     t5 = System.nanoTime();
 
     rtAssert(TestUtil.specialEquals(skD, skR, false, true));
-    Flavor fA = skA.getFlavor();
-    Flavor fB = skB.getFlavor();
-    Flavor fR = skR.getFlavor();
-    String aOff = Integer.toString(skA.windowOffset);
-    String bOff = Integer.toString(skB.windowOffset);
-    String rOff = Integer.toString(skR.windowOffset);
-    String fAoff = fA + String.format("%2s",aOff);
-    String fBoff = fB + String.format("%2s",bOff);
-    String fRoff = fR + String.format("%2s",rOff);
-    double updA_mS = (t1 - t0) / 2E6;  //update A,D to cA
-    double updB_mS = (t2 - t1) / 2E6;  //update B,D to cB
-    double mrgA_mS = (t3 - t2) / 1E6;  //merge A
-    double mrgB_mS = (t4 - t3) / 1E6;  //merge B
-    double rslt_mS = (t5 - t4) / 1E6;  //get Result
+    final Flavor fA = skA.getFlavor();
+    final Flavor fB = skB.getFlavor();
+    final Flavor fR = skR.getFlavor();
+    final String aOff = Integer.toString(skA.windowOffset);
+    final String bOff = Integer.toString(skB.windowOffset);
+    final String rOff = Integer.toString(skR.windowOffset);
+    final String fAoff = fA + String.format("%2s",aOff);
+    final String fBoff = fB + String.format("%2s",bOff);
+    final String fRoff = fR + String.format("%2s",rOff);
+    final double updA_mS = (t1 - t0) / 2E6;  //update A,D to cA
+    final double updB_mS = (t2 - t1) / 2E6;  //update B,D to cB
+    final double mrgA_mS = (t3 - t2) / 1E6;  //merge A
+    final double mrgB_mS = (t4 - t3) / 1E6;  //merge B
+    final double rslt_mS = (t5 - t4) / 1E6;  //get Result
 
     printf(dfmt, lgK, cA, cB, fAoff, fBoff, fRoff,
         updA_mS, updB_mS, mrgA_mS, mrgB_mS, rslt_mS);
   }
 
 
-  private void printf(String format, Object ... args) {
+  private void printf(final String format, final Object ... args) {
     if (printStream != null) { printStream.printf(format, args); }
     if (printWriter != null) { printWriter.printf(format, args); }
   }
 
   private void assembleFormats() {
-    String[][] assy = {
+    final String[][] assy = {
         {"lgK",         "%3s",  "%3d"},
         {"Ca",          "%10s", "%10d"},
         {"Cb",          "%10s", "%10d"},
@@ -149,13 +154,13 @@ public class QuickMergingValidation {
         {"mrgB_mS",     "%9s",  "%9.3f"},
         {"rslt_mS",     "%9s",  "%9.3f"}
     };
-    int cols = assy.length;
+    final int cols = assy.length;
     hStrArr = new String[cols];
-    StringBuilder headerFmt = new StringBuilder();
-    StringBuilder dataFmt = new StringBuilder();
+    final StringBuilder headerFmt = new StringBuilder();
+    final StringBuilder dataFmt = new StringBuilder();
     headerFmt.append("\nQuick Merging Validation\n");
     for (int i = 0; i < cols; i++) {
-      hStrArr[i] =assy[i][0];
+      hStrArr[i] = assy[i][0];
       headerFmt.append(assy[i][1]);
       headerFmt.append((i < (cols - 1)) ? "\t" : "\n");
       dataFmt.append(assy[i][2]);
diff --git a/src/test/java/org/apache/datasketches/cpc/StreamingValidation.java b/src/main/java/org/apache/datasketches/cpc/StreamingValidation.java
similarity index 76%
rename from src/test/java/org/apache/datasketches/cpc/StreamingValidation.java
rename to src/main/java/org/apache/datasketches/cpc/StreamingValidation.java
index 4a883fe..6e9c9ef 100644
--- a/src/test/java/org/apache/datasketches/cpc/StreamingValidation.java
+++ b/src/main/java/org/apache/datasketches/cpc/StreamingValidation.java
@@ -27,6 +27,11 @@ import java.io.PrintStream;
 import java.io.PrintWriter;
 
 /**
+ * This code is used both by unit tests, for short running tests,
+ * and by the characterization repository for longer running, more exhaustive testing. To be
+ * accessible for both, this code is part of the main hierarchy. It is not used during normal
+ * production runtime.
+ *
  * @author Lee Rhodes
  * @author Kevin Lang
  */
@@ -50,8 +55,8 @@ public class StreamingValidation {
   private CpcSketch sketch = null;
   private BitMatrix matrix = null;
 
-  public StreamingValidation(int lgMinK, int lgMaxK, int trials, int ppoN, PrintStream pS,
-      PrintWriter pW) {
+  public StreamingValidation(final int lgMinK, final int lgMaxK, final int trials, final int ppoN,
+      final PrintStream pS, final PrintWriter pW) {
     this.lgMinK = lgMinK;
     this.lgMaxK = lgMaxK;
     this.trials = trials;
@@ -72,9 +77,9 @@ public class StreamingValidation {
     }
   }
 
-  private void doRangeOfNAtLgK(int lgK) {
+  private void doRangeOfNAtLgK(final int lgK) {
     long n = 1;
-    long maxN = 64L * (1L << lgK); //1200
+    final long maxN = 64L * (1L << lgK); //1200
     while (n < maxN) {
       doTrialsAtLgKAtN(lgK, n);
       n = Math.round(pwrLawNextDouble(ppoN, n, true, 2.0));
@@ -86,7 +91,7 @@ public class StreamingValidation {
    * @param lgK the configured lgK
    * @param n the current value of n
    */
-  private void doTrialsAtLgKAtN(int lgK, long n) {
+  private void doTrialsAtLgKAtN(final int lgK, final long n) {
     double sumC = 0.0;
     double sumIconEst = 0.0;
     double sumHipEst = 0.0;
@@ -105,25 +110,25 @@ public class StreamingValidation {
       sumIconEst += IconEstimator.getIconEstimate(lgK, sketch.numCoupons);
       sumHipEst  += sketch.hipEstAccum;
       rtAssertEquals(sketch.numCoupons, matrix.getNumCoupons());
-      long[] bitMatrix = CpcUtil.bitMatrixOfSketch (sketch);
+      final long[] bitMatrix = CpcUtil.bitMatrixOfSketch(sketch);
       rtAssertEquals(bitMatrix, matrix.getMatrix());
     }
-    long finC = sketch.numCoupons;
-    Flavor finFlavor = sketch.getFlavor();
-    int finOff = sketch.windowOffset;
-    double avgC = sumC / trials;
-    double avgIconEst = sumIconEst / trials;
-    double avgHipEst = sumHipEst / trials;
+    final long finC = sketch.numCoupons;
+    final Flavor finFlavor = sketch.getFlavor();
+    final int finOff = sketch.windowOffset;
+    final double avgC = sumC / trials;
+    final double avgIconEst = sumIconEst / trials;
+    final double avgHipEst = sumHipEst / trials;
     printf(dfmt, lgK, trials, n, finC, finFlavor, finOff, avgC, avgIconEst, avgHipEst);
   }
 
-  private void printf(String format, Object ... args) {
+  private void printf(final String format, final Object ... args) {
     if (printStream != null) { printStream.printf(format, args); }
     if (printWriter != null) { printWriter.printf(format, args); }
   }
 
   private void assembleStrings() {
-    String[][] assy = {
+    final String[][] assy = {
         {"lgK",       "%3s",  "%3d"},
         {"Trials",    "%7s",  "%7d"},
         {"n",         "%8s",  "%8d"},
@@ -134,13 +139,13 @@ public class StreamingValidation {
         {"AvgICON",   "%12s", "%12.3f"},
         {"AvgHIP",    "%12s", "%12.3f"}
     };
-    int cols = assy.length;
+    final int cols = assy.length;
     hStrArr = new String[cols];
-    StringBuilder headerFmt = new StringBuilder();
-    StringBuilder dataFmt = new StringBuilder();
+    final StringBuilder headerFmt = new StringBuilder();
+    final StringBuilder dataFmt = new StringBuilder();
     headerFmt.append("\nStreaming Validation\n");
     for (int i = 0; i < cols; i++) {
-      hStrArr[i] =assy[i][0];
+      hStrArr[i] = assy[i][0];
       headerFmt.append(assy[i][1]);
       headerFmt.append((i < (cols - 1)) ? "\t" : "\n");
       dataFmt.append(assy[i][2]);
diff --git a/src/test/java/org/apache/datasketches/cpc/TestUtil.java b/src/main/java/org/apache/datasketches/cpc/TestUtil.java
similarity index 90%
rename from src/test/java/org/apache/datasketches/cpc/TestUtil.java
rename to src/main/java/org/apache/datasketches/cpc/TestUtil.java
index 70607ec..0a96db7 100644
--- a/src/test/java/org/apache/datasketches/cpc/TestUtil.java
+++ b/src/main/java/org/apache/datasketches/cpc/TestUtil.java
@@ -19,10 +19,10 @@
 
 package org.apache.datasketches.cpc;
 
-import static org.apache.datasketches.cpc.RuntimeAsserts.rtAssert;
-import static org.apache.datasketches.cpc.RuntimeAsserts.rtAssertEquals;
 import static java.lang.Math.pow;
 import static java.lang.Math.round;
+import static org.apache.datasketches.cpc.RuntimeAsserts.rtAssert;
+import static org.apache.datasketches.cpc.RuntimeAsserts.rtAssertEquals;
 
 /**
  * @author Lee Rhodes
@@ -72,21 +72,21 @@ public class TestUtil {
     return true;
   }
 
-  static int calculateFirstInterestingColumn(CpcSketch sketch) {
-    int offset = sketch.windowOffset;
+  static int calculateFirstInterestingColumn(final CpcSketch sketch) {
+    final int offset = sketch.windowOffset;
     if (offset == 0) {
       return 0;
     }
-    PairTable table = sketch.pairTable;
+    final PairTable table = sketch.pairTable;
     assert (table != null);
-    int[] slots = table.getSlotsArr();
-    int numSlots = 1 << table.getLgSizeInts();
+    final int[] slots = table.getSlotsArr();
+    final int numSlots = 1 << table.getLgSizeInts();
     int i;
     int result = offset;
     for (i = 0; i < numSlots; i++) {
-      int rowCol = slots[i];
+      final int rowCol = slots[i];
       if (rowCol != -1) {
-        int col = rowCol & 63;
+        final int col = rowCol & 63;
         if (col < result) { result = col; }
       }
     }
diff --git a/src/test/java/org/apache/datasketches/cpc/CpcCBinariesTest.java b/src/test/java/org/apache/datasketches/cpc/CpcCBinariesTest.java
index d578609..5c548f9 100644
--- a/src/test/java/org/apache/datasketches/cpc/CpcCBinariesTest.java
+++ b/src/test/java/org/apache/datasketches/cpc/CpcCBinariesTest.java
@@ -41,24 +41,24 @@ public class CpcCBinariesTest {
 
   @Test
   public void checkEmptyBin() {
-    String fileName = "cpc-empty.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-empty.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory wmem = mh.get();
+      final Memory wmem = mh.get();
       println(PreambleUtil.toString(wmem, true));
-      CpcSketch sk = CpcSketch.heapify(wmem);
+      final CpcSketch sk = CpcSketch.heapify(wmem);
       assertEquals(sk.getFlavor(), Flavor.EMPTY);
-    } catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
 
   @Test
   public void checkSparseBin() {
-    String fileName = "cpc-sparse.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-sparse.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory mem = mh.get();
+      final Memory mem = mh.get();
       println("CPP GENERATED SKETCH FROM BINARY FILE LgK=11, U0 to U99");
       println("PreambleUtil.toString(mem, true)" + LS);
       println(PreambleUtil.toString(mem, true));
@@ -66,25 +66,25 @@ public class CpcCBinariesTest {
       println(LS + LS + "################");
       println("CpcSketch sk = CpcSketch.heapify(mem);");
       println("sk.toString(true)" + LS);
-      CpcSketch sk = CpcSketch.heapify(mem);
+      final CpcSketch sk = CpcSketch.heapify(mem);
       println(sk.toString(true));
       assertEquals(sk.getFlavor(), Flavor.SPARSE);
-      double est1 = sk.getEstimate();
+      final double est1 = sk.getEstimate();
       assertEquals(est1, 100, 100 * .02);
       for (int i = 0; i < 100; i++) { sk.update(i); }
-      double est2 = sk.getEstimate();
+      final double est2 = sk.getEstimate();
       assertEquals(est2, est1, 0); //assert no change
-    } catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
 
   @Test
   public void checkHybridBin() {
-    String fileName = "cpc-hybrid.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-hybrid.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory mem = mh.get();
+      final Memory mem = mh.get();
       println("CPP GENERATED SKETCH FROM BINARY FILE LgK=11, U0 to U199");
       println("PreambleUtil.toString(mem, true)" + LS);
       println(PreambleUtil.toString(mem, true));
@@ -92,25 +92,25 @@ public class CpcCBinariesTest {
       println(LS + LS + "################");
       println("CpcSketch sk = CpcSketch.heapify(mem);");
       println("sk.toString(true)" + LS);
-      CpcSketch sk = CpcSketch.heapify(mem);
+      final CpcSketch sk = CpcSketch.heapify(mem);
       println(sk.toString(true));
       assertEquals(sk.getFlavor(), Flavor.HYBRID);
-      double est1 = sk.getEstimate();
+      final double est1 = sk.getEstimate();
       assertEquals(est1, 200, 200 * .02);
       for (long i = 0; i < 200; i++) { sk.update(i); }
-      double est2 = sk.getEstimate();
+      final double est2 = sk.getEstimate();
       assertEquals(est2, est1, 0); //assert no change
-    } catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
 
   @Test
   public void checkPinnedBin() {
-    String fileName = "cpc-pinned.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-pinned.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory mem = mh.get();
+      final Memory mem = mh.get();
       println("CPP GENERATED SKETCH FROM BINARY FILE LgK=11, U0 to U1999");
       println("PreambleUtil.toString(mem, true)" + LS);
       println(PreambleUtil.toString(mem, true));
@@ -118,25 +118,25 @@ public class CpcCBinariesTest {
       println(LS + LS + "################");
       println("CpcSketch sk = CpcSketch.heapify(mem);");
       println("sk.toString(true)" + LS);
-      CpcSketch sk = CpcSketch.heapify(mem);
+      final CpcSketch sk = CpcSketch.heapify(mem);
       println(sk.toString(true));
       assertEquals(sk.getFlavor(), Flavor.PINNED);
-      double est1 = sk.getEstimate();
+      final double est1 = sk.getEstimate();
       assertEquals(est1, 2000, 2000 * .02);
       for (long i = 0; i < 2000; i++) { sk.update(i); }
-      double est2 = sk.getEstimate();
+      final double est2 = sk.getEstimate();
       assertEquals(est2, est1, 0); //assert no change
-    } catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
 
   @Test
   public void checkSlidingBin() {
-    String fileName = "cpc-sliding.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-sliding.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory mem = mh.get();
+      final Memory mem = mh.get();
       println("CPP GENERATED SKETCH FROM BINARY FILE LgK=11, U0 to U19999");
       println("PreambleUtil.toString(mem, true)" + LS);
       println(PreambleUtil.toString(mem, true));
@@ -144,15 +144,15 @@ public class CpcCBinariesTest {
       println(LS + LS + "################");
       println("CpcSketch sk = CpcSketch.heapify(mem);");
       println("sk.toString(true)" + LS);
-      CpcSketch sk = CpcSketch.heapify(mem);
+      final CpcSketch sk = CpcSketch.heapify(mem);
       println(sk.toString(true));
       assertEquals(sk.getFlavor(), Flavor.SLIDING);
-      double est1 = sk.getEstimate();
+      final double est1 = sk.getEstimate();
       assertEquals(est1, 20000, 20000 * .02);
       for (long i = 0; i < 20000; i++) { sk.update(i); }
-      double est2 = sk.getEstimate();
+      final double est2 = sk.getEstimate();
       assertEquals(est2, est1, 0);
-    } catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
@@ -161,118 +161,118 @@ public class CpcCBinariesTest {
 
   @Test
   public void checkEmptyImages() {
-    String fileName = "cpc-empty.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-empty.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory mem = mh.get();
-      int cap = (int) mem.getCapacity();
-      byte[] memByteArr = new byte[cap];
+      final Memory mem = mh.get();
+      final int cap = (int) mem.getCapacity();
+      final byte[] memByteArr = new byte[cap];
       mem.getByteArray(0, memByteArr, 0, cap);
 
-      CpcSketch sk = new CpcSketch(11);
-      byte[] mem2ByteArr = sk.toByteArray();
-      Memory mem2 = Memory.wrap(mem2ByteArr);
+      final CpcSketch sk = new CpcSketch(11);
+      final byte[] mem2ByteArr = sk.toByteArray();
+      final Memory mem2 = Memory.wrap(mem2ByteArr);
       assertEquals(mem.getCapacity(), mem2.getCapacity());
       assertEquals(memByteArr, mem2ByteArr);
-    }catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
 
   @Test
   public void checkSparseImages() {
-    String fileName = "cpc-sparse.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-sparse.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory mem = mh.get();
-      int cap = (int) mem.getCapacity();
-      byte[] memByteArr = new byte[cap];
+      final Memory mem = mh.get();
+      final int cap = (int) mem.getCapacity();
+      final byte[] memByteArr = new byte[cap];
       mem.getByteArray(0, memByteArr, 0, cap);
 
-      CpcSketch sk = new CpcSketch(11);
+      final CpcSketch sk = new CpcSketch(11);
       for (int i = 0; i < 100; i++) { sk.update(i); }
-      byte[] mem2ByteArr = sk.toByteArray();
-      Memory mem2 = Memory.wrap(mem2ByteArr);
+      final byte[] mem2ByteArr = sk.toByteArray();
+      final Memory mem2 = Memory.wrap(mem2ByteArr);
       assertEquals(mem.getCapacity(), mem2.getCapacity());
       assertEquals(memByteArr, mem2ByteArr);
-    }catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
 
   @Test
   public void checkHybridImages() {
-    String fileName = "cpc-hybrid.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-hybrid.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory mem = mh.get();
-      int cap = (int) mem.getCapacity();
-      byte[] memByteArr = new byte[cap];
+      final Memory mem = mh.get();
+      final int cap = (int) mem.getCapacity();
+      final byte[] memByteArr = new byte[cap];
       mem.getByteArray(0, memByteArr, 0, cap);
 
-      CpcSketch sk = new CpcSketch(11);
+      final CpcSketch sk = new CpcSketch(11);
       for (int i = 0; i < 200; i++) { sk.update(i); }
-      byte[] mem2ByteArr = sk.toByteArray();
-      Memory mem2 = Memory.wrap(mem2ByteArr);
+      final byte[] mem2ByteArr = sk.toByteArray();
+      final Memory mem2 = Memory.wrap(mem2ByteArr);
       assertEquals(mem.getCapacity(), mem2.getCapacity());
       assertEquals(memByteArr, mem2ByteArr);
-    }catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
 
   @Test
   public void checkPinnedImages() {
-    String fileName = "cpc-pinned.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-pinned.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory mem = mh.get();
-      int cap = (int) mem.getCapacity();
-      byte[] cppMemByteArr = new byte[cap];
+      final Memory mem = mh.get();
+      final int cap = (int) mem.getCapacity();
+      final byte[] cppMemByteArr = new byte[cap];
       mem.getByteArray(0, cppMemByteArr, 0, cap);
 
-      CpcSketch sk = new CpcSketch(11);
+      final CpcSketch sk = new CpcSketch(11);
       for (int i = 0; i < 2000; i++) { sk.update(i); }
-      byte[] javaMemByteArr = sk.toByteArray();
-      Memory mem2 = Memory.wrap(javaMemByteArr);
+      final byte[] javaMemByteArr = sk.toByteArray();
+      final Memory mem2 = Memory.wrap(javaMemByteArr);
       assertEquals(mem.getCapacity(), mem2.getCapacity());
       assertEquals(cppMemByteArr, javaMemByteArr);
-    }catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
 
   @Test
   public void checkSlidingImages() {
-    String fileName = "cpc-sliding.bin";
-    File file = getResourceFile(fileName);
+    final String fileName = "cpc-sliding.bin";
+    final File file = getResourceFile(fileName);
     try (MapHandle mh = Memory.map(file)) {
-      Memory mem = mh.get();
-      int cap = (int) mem.getCapacity();
-      byte[] memByteArr = new byte[cap];
+      final Memory mem = mh.get();
+      final int cap = (int) mem.getCapacity();
+      final byte[] memByteArr = new byte[cap];
       mem.getByteArray(0, memByteArr, 0, cap);
 
-      CpcSketch sk = new CpcSketch(11);
+      final CpcSketch sk = new CpcSketch(11);
       for (int i = 0; i < 20000; i++) { sk.update(i); }
-      byte[] mem2ByteArr = sk.toByteArray();
-      Memory mem2 = Memory.wrap(mem2ByteArr);
+      final byte[] mem2ByteArr = sk.toByteArray();
+      final Memory mem2 = Memory.wrap(mem2ByteArr);
       assertEquals(mem.getCapacity(), mem2.getCapacity());
       assertEquals(memByteArr, mem2ByteArr);
-    }catch (IOException e) {
+    } catch (final IOException e) {
       e.printStackTrace();
     }
   }
 
   @Test //Internal consistency check
   public void genSparseSketch() {
-    CpcSketch sk = new CpcSketch(11);
+    final CpcSketch sk = new CpcSketch(11);
     for (int i = 0; i < 100; i++) { sk.update(i); }
     println("JAVA GENERATED SKETCH LgK=11, U0 to U99");
     println("sketch.toString(true);" + LS);
     println(sk.toString(true));
 
     println(LS + LS + "################");
-    byte[] byteArray = sk.toByteArray();
+    final byte[] byteArray = sk.toByteArray();
     println("sketch.toByteArray();");
     println("PreambleUtil.toString(byteArray, true);" + LS);
     println(PreambleUtil.toString(byteArray, true));
@@ -280,7 +280,7 @@ public class CpcCBinariesTest {
     println(LS + LS + "################");
     println("CpcSketch sk2 = CpcSketch.heapify(byteArray);");
     println("sk2.toString(true);" + LS);
-    CpcSketch sk2 = CpcSketch.heapify(byteArray);
+    final CpcSketch sk2 = CpcSketch.heapify(byteArray);
     println(sk2.toString(true));
   }
 
@@ -293,14 +293,14 @@ public class CpcCBinariesTest {
    * @param format the string to print
    * @param args the arguments
    */
-  static void printf(String format, Object... args) {
+  static void printf(final String format, final Object... args) {
     //ps.printf(format, args);
   }
 
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //ps.println(s); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/cpc/CpcCompressionTest.java b/src/test/java/org/apache/datasketches/cpc/CpcCompressionTest.java
index d2b66f8..1ddf1d6 100644
--- a/src/test/java/org/apache/datasketches/cpc/CpcCompressionTest.java
+++ b/src/test/java/org/apache/datasketches/cpc/CpcCompressionTest.java
@@ -48,7 +48,7 @@ public class CpcCompressionTest {
 
   @Test
   public void checkWriteReadUnary() {
-    int[] compressedWords = new int[256];
+    final int[] compressedWords = new int[256];
 
     final long[] ptrArr = new long[3];
     int nextWordIndex = 0; //must be int
@@ -72,7 +72,7 @@ public class CpcCompressionTest {
     }
 
     // Pad the bitstream so that the decompressor's 12-bit peek can't overrun its input.
-    long padding = 7;
+    final long padding = 7;
     bufBits += padding;
     //MAYBE_FLUSH_BITBUF(compressedWords, nextWordIndex);
     if (bufBits >= 32) {
@@ -85,7 +85,7 @@ public class CpcCompressionTest {
       assert (bufBits < 32);
       compressedWords[nextWordIndex++] = (int) bitBuf;
     }
-    int numWordsUsed = nextWordIndex;
+    final int numWordsUsed = nextWordIndex;
     println("Words used: " + numWordsUsed);
     nextWordIndex = 0; //must be int
     bitBuf = 0;       //must be long
@@ -114,13 +114,13 @@ public class CpcCompressionTest {
 
   @Test
   public void checkWriteReadBytes() {
-    int[] compressedWords = new int[128];
-    byte[] byteArray = new byte[256];
-    byte[] byteArray2 = new byte[256]; //output
+    final int[] compressedWords = new int[128];
+    final byte[] byteArray = new byte[256];
+    final byte[] byteArray2 = new byte[256]; //output
     for (int i = 0; i < 256; i++) { byteArray[i] = (byte) i; }
 
     for (int j = 0; j < 22; j++) {
-      long numWordsWritten = lowLevelCompressBytes(
+      final long numWordsWritten = lowLevelCompressBytes(
           byteArray, 256, encodingTablesForHighEntropyByte[j], compressedWords);
 
       lowLevelUncompressBytes(byteArray2, 256, decodingTablesForHighEntropyByte[j],
@@ -133,13 +133,13 @@ public class CpcCompressionTest {
 
   @Test
   public void checkWriteReadBytes65() {
-    int size = 65;
-    int[] compressedWords = new int[128];
-    byte[] byteArray = new byte[size];
-    byte[] byteArray2 = new byte[size]; //output
+    final int size = 65;
+    final int[] compressedWords = new int[128];
+    final byte[] byteArray = new byte[size];
+    final byte[] byteArray2 = new byte[size]; //output
     for (int i = 0; i < size; i++) { byteArray[i] = (byte) i; }
 
-    long numWordsWritten = lowLevelCompressBytes(
+    final long numWordsWritten = lowLevelCompressBytes(
         byteArray, size, lengthLimitedUnaryEncodingTable65, compressedWords);
 
     lowLevelUncompressBytes(byteArray2, size, lengthLimitedUnaryDecodingTable65,
@@ -152,15 +152,15 @@ public class CpcCompressionTest {
 
   @Test
   public void checkWriteReadPairs() {
-    Random rgen = new Random(1);
-    int lgK = 14;
-    int N = 3000;
+    final Random rgen = new Random(1);
+    final int lgK = 14;
+    final int N = 3000;
     final int MAX_WORDS = 4000;
-    int[] pairArray  = new int[N];
-    int[] pairArray2 = new int[N];
+    final int[] pairArray  = new int[N];
+    final int[] pairArray2 = new int[N];
     int i;
     for (i = 0; i < N; i++) {
-      int rand = rgen.nextInt(1 << (lgK + 6));
+      final int rand = rgen.nextInt(1 << (lgK + 6));
       pairArray[i] = rand;
     }
     Arrays.sort(pairArray);   //must be unsigned sort! So keep lgK < 26
@@ -172,14 +172,14 @@ public class CpcCompressionTest {
         pairArray[nxt++] = pairArray[i];
       }
     }
-    int numPairs = nxt;
+    final int numPairs = nxt;
     println("numCsv = " + numPairs);
 
-    int[] compressedWords = new int[MAX_WORDS];
+    final int[] compressedWords = new int[MAX_WORDS];
     int bb; // numBaseBits
 
     for (bb = 0; bb <= 11; bb++) {
-      Long numWordsWritten =
+      final Long numWordsWritten =
         lowLevelCompressPairs(pairArray, numPairs, bb, compressedWords);
         println("numWordsWritten = " + numWordsWritten + ", bb = " + bb);
 
@@ -199,7 +199,7 @@ public class CpcCompressionTest {
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/cpc/CpcSketchTest.java b/src/test/java/org/apache/datasketches/cpc/CpcSketchTest.java
index f741e65..4f20ada 100644
--- a/src/test/java/org/apache/datasketches/cpc/CpcSketchTest.java
+++ b/src/test/java/org/apache/datasketches/cpc/CpcSketchTest.java
@@ -27,11 +27,10 @@ import static org.testng.Assert.fail;
 
 import java.io.PrintStream;
 
-import org.testng.annotations.Test;
-
-import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.Family;
 import org.apache.datasketches.SketchesArgumentException;
+import org.apache.datasketches.memory.Memory;
+import org.testng.annotations.Test;
 
 /**
  * @author Lee Rhodes
@@ -42,7 +41,7 @@ public class CpcSketchTest {
 
   @Test
   public void checkUpdatesEstimate() {
-    CpcSketch sk = new CpcSketch(10, 0);
+    final CpcSketch sk = new CpcSketch(10, 0);
     println(sk.toString(true));
     assertEquals(sk.getFormat(), Format.EMPTY_HIP);
     sk.update(1L);
@@ -52,9 +51,9 @@ public class CpcSketchTest {
     sk.update(new char[] { 5 });
     sk.update(new int[] { 6 });
     sk.update(new long[] { 7 });
-    double est = sk.getEstimate();
-    double lb = sk.getLowerBound(2);
-    double ub = sk.getUpperBound(2);
+    final double est = sk.getEstimate();
+    final double lb = sk.getLowerBound(2);
+    final double ub = sk.getUpperBound(2);
     assertTrue(lb >= 0);
     assertTrue(lb <= est);
     assertTrue(est <= ub);
@@ -66,21 +65,21 @@ public class CpcSketchTest {
 
   @Test
   public void checkEstimatesWithMerge() {
-    int lgK = 4;
-    CpcSketch sk1 = new CpcSketch(lgK);
-    CpcSketch sk2 = new CpcSketch(lgK);
-    int n = 1 << lgK;
+    final int lgK = 4;
+    final CpcSketch sk1 = new CpcSketch(lgK);
+    final CpcSketch sk2 = new CpcSketch(lgK);
+    final int n = 1 << lgK;
     for (int i = 0; i < n; i++ ) {
       sk1.update(i);
       sk2.update(i + n);
     }
-    CpcUnion union = new CpcUnion(lgK);
+    final CpcUnion union = new CpcUnion(lgK);
     union.update(sk1);
     union.update(sk2);
-    CpcSketch result = union.getResult();
-    double est = result.getEstimate();
-    double lb = result.getLowerBound(2);
-    double ub = result.getUpperBound(2);
+    final CpcSketch result = union.getResult();
+    final double est = result.getEstimate();
+    final double lb = result.getLowerBound(2);
+    final double ub = result.getUpperBound(2);
     assertTrue(lb >= 0);
     assertTrue(lb <= est);
     assertTrue(est <= ub);
@@ -90,8 +89,8 @@ public class CpcSketchTest {
 
   @Test
   public void checkCornerCaseUpdates() {
-    int lgK = 4;
-    CpcSketch sk = new CpcSketch(lgK);
+    final int lgK = 4;
+    final CpcSketch sk = new CpcSketch(lgK);
     sk.update(0.0);
     sk.update(-0.0);
     int est = (int) Math.round(sk.getEstimate());
@@ -138,25 +137,25 @@ public class CpcSketchTest {
 
   @Test
   public void checkCornerHashUpdates() {
-    CpcSketch sk = new CpcSketch(26);
-    long hash1 = 0;
-    long hash0 = -1L;
+    final CpcSketch sk = new CpcSketch(26);
+    final long hash1 = 0;
+    final long hash0 = -1L;
     sk.hashUpdate(hash0, hash1);
-    PairTable table = sk.pairTable;
+    final PairTable table = sk.pairTable;
     println(table.toString(true));
   }
 
   @SuppressWarnings("unused")
   @Test
   public void checkCopyWithWindow() {
-    int lgK = 4;
-    CpcSketch sk = new CpcSketch(lgK);
+    final int lgK = 4;
+    final CpcSketch sk = new CpcSketch(lgK);
     CpcSketch sk2 = sk.copy();
     for (int i = 0; i < (1 << lgK); i++) { //pinned
       sk.update(i);
     }
     sk2 = sk.copy();
-    long[] bitMatrix = CpcUtil.bitMatrixOfSketch(sk);
+    final long[] bitMatrix = CpcUtil.bitMatrixOfSketch(sk);
     CpcSketch.refreshKXP(sk, bitMatrix);
   }
 
@@ -172,7 +171,7 @@ public class CpcSketchTest {
     try {
       sk = new CpcSketch(3);
       fail();
-    } catch (SketchesArgumentException e) {}
+    } catch (final SketchesArgumentException e) { }
   }
 
   @Test
diff --git a/src/test/java/org/apache/datasketches/cpc/LzTzSpeedTesting.java b/src/test/java/org/apache/datasketches/cpc/LzTzSpeedTest.java
similarity index 97%
rename from src/test/java/org/apache/datasketches/cpc/LzTzSpeedTesting.java
rename to src/test/java/org/apache/datasketches/cpc/LzTzSpeedTest.java
index f2e61aa..b134eea 100644
--- a/src/test/java/org/apache/datasketches/cpc/LzTzSpeedTesting.java
+++ b/src/test/java/org/apache/datasketches/cpc/LzTzSpeedTest.java
@@ -29,12 +29,13 @@ import java.util.Random;
  * intrinsic CPU instructions instead of the documented code. The java built=in functions are much
  * faster than even choosing most probable bytes algorithms that were derived from C.
  *
- * <p>These tests are for experimental testing only and are not enabled for normal unit testing.
+ * <p>These tests are for experimental characterization testing only and are not enabled for
+ * normal unit testing.
  *
  * @author Lee Rhodes
  */
 @SuppressWarnings("javadoc")
-public class LzTzSpeedTesting {
+public class LzTzSpeedTest {
   static final byte[] byteTrailingZerosTable = new byte[256];
   static final byte[] byteLeadingZerosTable = new byte[256];
 
diff --git a/src/test/java/org/apache/datasketches/cpc/TestAllTest.java b/src/test/java/org/apache/datasketches/cpc/TestAllTest.java
index 006cfd5..d09db5b 100644
--- a/src/test/java/org/apache/datasketches/cpc/TestAllTest.java
+++ b/src/test/java/org/apache/datasketches/cpc/TestAllTest.java
@@ -31,17 +31,18 @@ import org.testng.annotations.Test;
  */
 @SuppressWarnings("javadoc")
 public class TestAllTest {
+  // Enable these as desired for all tests.
+  private PrintStream ps = null; //System.out; //prints to console
+  private PrintWriter pw = null; //prints to file (optional)
 
   //STREAMING
 
-  @Test
+  @Test //scope = Test
   public void streamingCheck() {
     int lgMinK = 10;
     int lgMaxK = 10;
     int trials = 10;
     int ppoN = 1;
-    PrintStream ps = null;//System.out;
-    PrintWriter pw = null;
 
     StreamingValidation sVal = new StreamingValidation(
         lgMinK, lgMaxK, trials, ppoN, ps, pw);
@@ -50,7 +51,7 @@ public class TestAllTest {
 
   //COMPRESSION
 
-  @Test
+  @Test //scope = Test
   public void compressionCharacterizationCheck() {
     int lgMinK = 10;
     int lgMaxK = 10;
@@ -59,8 +60,6 @@ public class TestAllTest {
     int lgMulK = 7;
     int uPPO = 1;
     int incLgK = 1;
-    PrintStream ps = null; //System.out;
-    PrintWriter pw = null;
 
     CompressionCharacterization cc = new CompressionCharacterization(
         lgMinK, lgMaxK, lgMinT, lgMaxT, lgMulK, uPPO, incLgK, ps, pw);
@@ -69,7 +68,6 @@ public class TestAllTest {
 
   //@Test //used for troubleshooting a specific rowCol problems
   public void singleRowColCheck() {
-    PrintStream ps = System.out;
     int lgK = 20;
     CpcSketch srcSketch = new CpcSketch(lgK);
     int rowCol = 54746379;
@@ -84,28 +82,24 @@ public class TestAllTest {
 
   //MERGING
 
-  //@Test //long test. use for characterization
+  //@Test //longer test. use for characterization
   public void mergingValidationCheck() {
     int lgMinK = 10;
     int lgMaxK = 10; //inclusive
     int lgMulK = 5;  //5
     int uPPO = 1; //16
     int incLgK = 1;
-    PrintStream ps = null;//System.out;
-    PrintWriter pw = null;
 
     MergingValidation mv = new MergingValidation(
         lgMinK, lgMaxK, lgMulK, uPPO, incLgK, ps, pw);
     mv.start();
   }
 
-  @Test
+  @Test //scope = Test
   public void quickMergingValidationCheck() {
     int lgMinK = 10;
     int lgMaxK = 10;
     int incLgK = 1;
-    PrintStream ps = null;//System.out;
-    PrintWriter pw = null;
 
     QuickMergingValidation qmv = new QuickMergingValidation(
         lgMinK, lgMaxK, incLgK, ps, pw);
diff --git a/src/test/java/org/apache/datasketches/frequencies/StressTestHashMap.java b/src/test/java/org/apache/datasketches/frequencies/HashMapStressTest.java
similarity index 79%
rename from src/test/java/org/apache/datasketches/frequencies/StressTestHashMap.java
rename to src/test/java/org/apache/datasketches/frequencies/HashMapStressTest.java
index 947af9b..9d1da66 100644
--- a/src/test/java/org/apache/datasketches/frequencies/StressTestHashMap.java
+++ b/src/test/java/org/apache/datasketches/frequencies/HashMapStressTest.java
@@ -20,15 +20,15 @@
 package org.apache.datasketches.frequencies;
 
 import org.apache.datasketches.hash.MurmurHash3;
+//import org.testng.annotations.Test;
 
 @SuppressWarnings("javadoc")
-public class StressTestHashMap {
+public class HashMapStressTest {
 
-  public static void main(String[] args) {
-    stress();
-  }
-
-  private static void stress() {
+  //@Test
+  public static void stress() {
+    println("ReversePurgeLongHashMap Stress Test");
+    printf("%12s%15s%n", "Capacity", "TimePerAdjust");
     for (int capacity = 2 << 5; capacity < (2 << 24); capacity *= 2) {
       int n = 10000000;
 
@@ -42,11 +42,12 @@ public class StressTestHashMap {
 
       ReversePurgeLongHashMap hashmap = new ReversePurgeLongHashMap(capacity);
       long timePerAdjust = timeOneHashMap(hashmap, keys, values, (int) (.75 * capacity));
-      System.out.format("%s\t%d\t%d%n", hashmap.getClass().getSimpleName(), capacity, timePerAdjust);
+      printf("%12d%15d%n", capacity, timePerAdjust);
     }
   }
 
-  private static long timeOneHashMap(ReversePurgeLongHashMap hashMap, long[] keys, long[] values, int sizeToShift) {
+  private static long timeOneHashMap(ReversePurgeLongHashMap hashMap, long[] keys, long[] values,
+      int sizeToShift) {
     final long startTime = System.nanoTime();
     int n = keys.length;
     assert (n == values.length);
@@ -65,4 +66,9 @@ public class StressTestHashMap {
     long[] keyArr = { key };
     return MurmurHash3.hash(keyArr, 0)[0];
   }
-}
+
+  private static void println(Object obj) { System.out.println(obj.toString()); }
+
+  private static void printf(String fmt, Object ... args) { System.out.printf(fmt, args); }
+
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/datasketches/theta/BackwardConversions.java b/src/test/java/org/apache/datasketches/theta/BackwardConversions.java
index fee5c30..d0f9081 100644
--- a/src/test/java/org/apache/datasketches/theta/BackwardConversions.java
+++ b/src/test/java/org/apache/datasketches/theta/BackwardConversions.java
@@ -19,10 +19,10 @@
 
 package org.apache.datasketches.theta;
 
-import org.apache.datasketches.memory.Memory;
-import org.apache.datasketches.memory.WritableMemory;
 import org.apache.datasketches.SketchesArgumentException;
 import org.apache.datasketches.Util;
+import org.apache.datasketches.memory.Memory;
+import org.apache.datasketches.memory.WritableMemory;
 
 /**
  * This class converts current compact sketches into prior SerVer 1 and SerVer 2 format for testing.
@@ -77,16 +77,16 @@ public class BackwardConversions {
    * @param skV3 a SerVer3, ordered CompactSketch
    * @return a SerVer1 SetSketch as Memory object.
    */
-  public static Memory convertSerVer3toSerVer1(CompactSketch skV3) {
+  public static Memory convertSerVer3toSerVer1(final CompactSketch skV3) {
     //Check input sketch
-    boolean validIn = skV3.isCompact() && skV3.isOrdered() && !skV3.hasMemory();
+    final boolean validIn = skV3.isCompact() && skV3.isOrdered() && !skV3.hasMemory();
     if (!validIn) {
       throw new SketchesArgumentException("Invalid input sketch.");
     }
 
     //Build V1 SetSketch in memory
-    int curCount = skV3.getRetainedEntries(true);
-    WritableMemory wmem = WritableMemory.allocate((3 + curCount) << 3);
+    final int curCount = skV3.getRetainedEntries(true);
+    final WritableMemory wmem = WritableMemory.allocate((3 + curCount) << 3);
     //Pre0
     wmem.putByte(0, (byte) 3); //preLongs
     wmem.putByte(1, (byte) 1); //SerVer
@@ -181,8 +181,8 @@ public class BackwardConversions {
    * @param seed used for checking the seed hash (if one exists).
    * @return a SerVer2 SetSketch as Memory object.
    */
-  public static Memory convertSerVer3toSerVer2(CompactSketch skV3, long seed) {
-    short seedHash = Util.computeSeedHash(seed);
+  public static Memory convertSerVer3toSerVer2(final CompactSketch skV3, final long seed) {
+    final short seedHash = Util.computeSeedHash(seed);
     WritableMemory wmem = null;
 
     if (skV3 instanceof EmptyCompactSketch) {
@@ -190,30 +190,30 @@ public class BackwardConversions {
       wmem.putByte(0, (byte) 1); //preLongs
       wmem.putByte(1, (byte) 2); //SerVer
       wmem.putByte(2, (byte) 3); //SetSketch
-      byte flags = (byte) 0xE;  //NoRebuild, Empty, ReadOnly, LE
+      final byte flags = (byte) 0xE;  //NoRebuild, Empty, ReadOnly, LE
       wmem.putByte(5, flags);
       wmem.putShort(6, seedHash);
       return wmem;
     }
     if (skV3 instanceof SingleItemSketch) {
-      SingleItemSketch sis = (SingleItemSketch) skV3;
+      final SingleItemSketch sis = (SingleItemSketch) skV3;
       wmem = WritableMemory.allocate(24);
       wmem.putByte(0, (byte) 2); //preLongs
       wmem.putByte(1, (byte) 2); //SerVer
       wmem.putByte(2, (byte) 3); //SetSketch
-      byte flags = (byte) 0xA;  //NoRebuild, notEmpty, ReadOnly, LE
+      final byte flags = (byte) 0xA;  //NoRebuild, notEmpty, ReadOnly, LE
       wmem.putByte(5, flags);
       wmem.putShort(6, seedHash);
       wmem.putInt(8, 1);
-      long[] arr = sis.getCache();
+      final long[] arr = sis.getCache();
       wmem.putLong(16,  arr[0]);
       return wmem;
     }
     //General CompactSketch
-    int preLongs = skV3.getCurrentPreambleLongs(true);
-    int entries = skV3.getRetainedEntries();
-    boolean unordered = !(skV3.isOrdered());
-    byte flags = (byte) (0xA | (unordered ? 16 : 0));  //Unordered, NoRebuild, notEmpty, ReadOnly, LE
+    final int preLongs = skV3.getCurrentPreambleLongs(true);
+    final int entries = skV3.getRetainedEntries();
+    final boolean unordered = !(skV3.isOrdered());
+    final byte flags = (byte) (0xA | (unordered ? 16 : 0)); //Unordered, NoRebuild, notEmpty, ReadOnly, LE
     wmem = WritableMemory.allocate((preLongs + entries) << 3);
     wmem.putByte(0, (byte) preLongs); //preLongs
     wmem.putByte(1, (byte) 2); //SerVer
@@ -225,8 +225,8 @@ public class BackwardConversions {
     if (preLongs == 3) {
       wmem.putLong(16, skV3.getThetaLong());
     }
-    long[] arr = skV3.getCache();
-    wmem.putLongArray(preLongs*8, arr, 0, entries);
+    final long[] arr = skV3.getCache();
+    wmem.putLongArray(preLongs * 8, arr, 0, entries);
     return wmem;
   }
 }
diff --git a/src/test/java/org/apache/datasketches/tuple/TestUtil.java b/src/test/java/org/apache/datasketches/tuple/TestUtil.java
index 2c33785..9f88393 100644
--- a/src/test/java/org/apache/datasketches/tuple/TestUtil.java
+++ b/src/test/java/org/apache/datasketches/tuple/TestUtil.java
@@ -27,31 +27,31 @@ import java.util.List;
 
 @SuppressWarnings("javadoc")
 public class TestUtil {
-  public static List<Double> asList(double[] array) {
-    List<Double> list = new ArrayList<>(array.length);
+  public static List<Double> asList(final double[] array) {
+    final List<Double> list = new ArrayList<>(array.length);
     for (int i = 0; i < array.length; i++) {
       list.add(array[i]);
     }
     return list;
   }
 
-  public static List<Float> asList(float[] array) {
-    List<Float> list = new ArrayList<>(array.length);
+  public static List<Float> asList(final float[] array) {
+    final List<Float> list = new ArrayList<>(array.length);
     for (int i = 0; i < array.length; i++) {
       list.add(array[i]);
     }
     return list;
   }
 
-  public static List<Long> asList(long[] array) {
-    List<Long> list = new ArrayList<>(array.length);
+  public static List<Long> asList(final long[] array) {
+    final List<Long> list = new ArrayList<>(array.length);
     for (int i = 0; i < array.length; i++) {
       list.add(array[i]);
     }
     return list;
   }
 
-  public static void writeBytesToFile(byte[] bytes, String fileName) throws IOException {
+  public static void writeBytesToFile(final byte[] bytes, final String fileName) throws IOException {
     try (FileOutputStream out = new FileOutputStream(new File(fileName))) {
       out.write(bytes);
     }
diff --git a/src/test/java/org/apache/datasketches/tuple/aninteger/EngagementTest.java b/src/test/java/org/apache/datasketches/tuple/aninteger/EngagementTest.java
index 7413181..631e688 100644
--- a/src/test/java/org/apache/datasketches/tuple/aninteger/EngagementTest.java
+++ b/src/test/java/org/apache/datasketches/tuple/aninteger/EngagementTest.java
@@ -139,6 +139,6 @@ public class EngagementTest {
    * @param args arguments
    */
   private static void printf(String fmt, Object ... args) {
-    System.out.printf(fmt, args); //Enable/Disable printing here
+    //System.out.printf(fmt, args); //Enable/Disable printing here
   }
 }
diff --git a/tools/SketchesCheckstyle.xml b/tools/SketchesCheckstyle.xml
index bd5e06b..3373e58 100644
--- a/tools/SketchesCheckstyle.xml
+++ b/tools/SketchesCheckstyle.xml
@@ -26,7 +26,7 @@ under the License.
   SketchesCheckstyle.xml
 
   Checkstyle is very configurable. Be sure to read the documentation at
-  http://checkstyle.sourceforge.net (or in your downloaded distribution). Note: Does not work with https.
+  http://checkstyle.sourceforge.net (or in your downloaded distribution).
 
   To completely disable a check, just comment it out or delete it from the file.
 
@@ -38,6 +38,10 @@ under the License.
   <property name="severity" value="warning"/>
   <property name="fileExtensions" value="java"/>
 
+  <module name="BeforeExecutionExclusionFileFilter">
+    <property name="fileNamePattern" value=".*Test\.java$"/>
+  </module>
+
   <module name="FileTabCharacter">
     <property name="eachLine" value="true"/>
   </module>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[incubator-datasketches-java] 01/02: Mostly code cleanup

Posted by le...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch Cleanup
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-java.git

commit 71133e1f5828a570783dc1aa7cbca071118cd856
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Nov 25 16:57:27 2019 -0800

    Mostly code cleanup
---
 .../apache/datasketches/hllmap/package-info.java   |   2 +-
 .../java/org/apache/datasketches/package-info.java |   2 +-
 .../apache/datasketches/BinomialBoundsNTest.java   |  78 +++----
 .../BoundsOnBinomialProportionsTest.java           | 100 ++++----
 .../BoundsOnRatiosInThetaSketchedSetsTest.java     |  53 +++--
 .../org/apache/datasketches/ByteArrayUtilTest.java |  80 +++----
 .../java/org/apache/datasketches/FamilyTest.java   |  26 +--
 .../apache/datasketches/HashOperationsTest.java    |  53 +++--
 .../org/apache/datasketches/QuickSelectTest.java   | 258 ++++++++++-----------
 .../apache/datasketches/SketchesExceptionTest.java |   4 +-
 .../java/org/apache/datasketches/UtilTest.java     |  72 +++---
 .../org/apache/datasketches/cpc/BitMatrix.java     |  10 +-
 .../datasketches/cpc/CompressedStateTest.java      |  25 +-
 .../cpc/CompressionCharacterization.java           |  90 +++----
 tools/SketchesCheckstyle.xml                       |  14 +-
 15 files changed, 441 insertions(+), 426 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/hllmap/package-info.java b/src/main/java/org/apache/datasketches/hllmap/package-info.java
index 0ba1bb8..373a9f2 100644
--- a/src/main/java/org/apache/datasketches/hllmap/package-info.java
+++ b/src/main/java/org/apache/datasketches/hllmap/package-info.java
@@ -18,7 +18,7 @@
  */
 
 /**
- * <p>The hllmap package contains a space efficient HLL mapping sketch of keys to approximate unique
+ * The hllmap package contains a space efficient HLL mapping sketch of keys to approximate unique
  * count of identifiers. For example, counting the number of unique users (identifiers) per IP
  * address.
  *
diff --git a/src/main/java/org/apache/datasketches/package-info.java b/src/main/java/org/apache/datasketches/package-info.java
index ffe2f13..b5ed8c8 100644
--- a/src/main/java/org/apache/datasketches/package-info.java
+++ b/src/main/java/org/apache/datasketches/package-info.java
@@ -18,7 +18,7 @@
  */
 
 /**
- * <p>This package is the parent package for all sketch algorithms.
+ * This package is the parent package for all sketch algorithms.
  * Classes at this level are used by more than one sub-package.
  *
  * @author Lee Rhodes
diff --git a/src/test/java/org/apache/datasketches/BinomialBoundsNTest.java b/src/test/java/org/apache/datasketches/BinomialBoundsNTest.java
index 578c39e..2b6a486 100644
--- a/src/test/java/org/apache/datasketches/BinomialBoundsNTest.java
+++ b/src/test/java/org/apache/datasketches/BinomialBoundsNTest.java
@@ -34,7 +34,7 @@ import org.testng.annotations.Test;
 @SuppressWarnings("javadoc")
 public class BinomialBoundsNTest {
 
-  public static double[] runTestAux (long max_numSamplesI, int ci, double min_p) {
+  public static double[] runTestAux(final long max_numSamplesI, final int ci, final double min_p) {
     long numSamplesI = 0;
     double p, lb, ub;
     double sum1 = 0.0;
@@ -47,31 +47,31 @@ public class BinomialBoundsNTest {
       p = 1.0;
 
       while (p >= min_p) {
-        lb = BinomialBoundsN.getLowerBound (numSamplesI, p, ci, false);
-        ub = BinomialBoundsN.getUpperBound (numSamplesI, p, ci, false);
+        lb = BinomialBoundsN.getLowerBound(numSamplesI, p, ci, false);
+        ub = BinomialBoundsN.getUpperBound(numSamplesI, p, ci, false);
 
         // if (numSamplesI == 300 && p > 0.365 && p < 0.367) { ub += 0.01; }  // artificial discrepancy
 
         // the logarithm helps discrepancies to not be swamped out of the total
-        sum1 += Math.log (lb + 1.0);
-        sum2 += Math.log (ub + 1.0);
+        sum1 += Math.log(lb + 1.0);
+        sum2 += Math.log(ub + 1.0);
         count += 2;
 
         if (p < 1.0) {
-          lb = BinomialBoundsN.getLowerBound (numSamplesI, 1.0 - p, ci, false);
-          ub = BinomialBoundsN.getUpperBound (numSamplesI, 1.0 - p, ci, false);
-          sum3 += Math.log (lb + 1.0);
-          sum4 += Math.log (ub + 1.0);
+          lb = BinomialBoundsN.getLowerBound(numSamplesI, 1.0 - p, ci, false);
+          ub = BinomialBoundsN.getUpperBound(numSamplesI, 1.0 - p, ci, false);
+          sum3 += Math.log(lb + 1.0);
+          sum4 += Math.log(ub + 1.0);
           count += 2;
         }
 
         p *= 0.99;
       }
-      numSamplesI = Math.max (numSamplesI+1, (1001*numSamplesI)/1000);
+      numSamplesI = Math.max(numSamplesI + 1, (1001 * numSamplesI) / 1000);
     }
 
     println(String.format("{%.15e, %.15e, %.15e, %.15e, %d}", sum1, sum2, sum3, sum4, count));
-    double[] arrOut = {sum1, sum2, sum3, sum4, count};
+    final double[] arrOut = {sum1, sum2, sum3, sum4, count};
     return arrOut;
   }
 
@@ -81,24 +81,24 @@ public class BinomialBoundsNTest {
   public static void checkBounds() {
     int i = 0;
     for (int ci = 1; ci <= 3; ci++, i++) {
-      double[] arr = runTestAux (20, ci, 1e-3);
-      for (int j=0; j<5; j++) {
-        assertTrue(((arr[j] / std[i][j]) -1.0) < TOL);
+      final double[] arr = runTestAux(20, ci, 1e-3);
+      for (int j = 0; j < 5; j++) {
+        assertTrue(((arr[j] / std[i][j]) - 1.0) < TOL);
       }
     }
     for (int ci = 1; ci <= 3; ci++, i++) {
-      double[] arr = runTestAux (200, ci, 1e-5);
-      for (int j=0; j<5; j++) {
-        assertTrue(((arr[j] / std[i][j]) -1.0) < TOL);
+      final double[] arr = runTestAux(200, ci, 1e-5);
+      for (int j = 0; j < 5; j++) {
+        assertTrue(((arr[j] / std[i][j]) - 1.0) < TOL);
       }
     }
     //comment last one out for a shorter test
-//    for (int ci = 1; ci <= 3; ci++, i++) {
-//      double[] arr = runTestAux (2000, ci, 1e-7);
-//      for (int j=0; j<5; j++) {
-//        assertTrue((arr[j] / std[i][j] -1.0) < TOL);
-//      }
-//    }
+    //  for (int ci = 1; ci <= 3; ci++, i++) {
+    //    final double[] arr = runTestAux(2000, ci, 1e-7);
+    //    for (int j = 0; j < 5; j++) {
+    //      assertTrue(((arr[j] / std[i][j]) - 1.0) < TOL);
+    //  }
+    //}
   }
 
   // With all 3 enabled the test should produce in groups of 3 */
@@ -126,19 +126,19 @@ public class BinomialBoundsNTest {
       checkArgs(10L, 1.0, 0);
       checkArgs(10L, 1.0, 4);
       fail("Expected SketchesArgumentException");
-    } catch (SketchesArgumentException e) {
+    } catch (final SketchesArgumentException e) {
       //pass
     }
   }
 
   @Test
   public static void checkComputeApproxBino_LB_UB() {
-    long n = 100;
-    double theta = (2.0 - 1e-5)/2.0;
+    final long n = 100;
+    final double theta = (2.0 - 1e-5) / 2.0;
     double result = getLowerBound(n, theta, 1, false);
     assertEquals(result, n, 0.0);
     result = getUpperBound(n, theta, 1, false);
-    assertEquals(result, n+1, 0.0);
+    assertEquals(result, n + 1, 0.0);
     result = getLowerBound(n, theta, 1, true);
     assertEquals(result, 0.0, 0.0);
     result = getUpperBound(n, theta, 1, true);
@@ -153,28 +153,28 @@ public class BinomialBoundsNTest {
   @Test
   public static void boundsExample() {
     println("BinomialBoundsN Example:");
-    int k = 500;
-    double theta = 0.001;
-    int stdDev = 2;
-    double ub = BinomialBoundsN.getUpperBound(k, theta, stdDev, false);
-    double est = k/theta;
-    double lb = BinomialBoundsN.getLowerBound(k, theta, stdDev, false);
-    println("K="+k+", Theta="+theta+", SD="+stdDev);
-    println("UB:  "+ub);
-    println("Est: "+est);
-    println("LB:  "+lb);
+    final int k = 500;
+    final double theta = 0.001;
+    final int stdDev = 2;
+    final double ub = BinomialBoundsN.getUpperBound(k, theta, stdDev, false);
+    final double est = k / theta;
+    final double lb = BinomialBoundsN.getLowerBound(k, theta, stdDev, false);
+    println("K=" + k + ", Theta=" + theta + ", SD=" + stdDev);
+    println("UB:  " + ub);
+    println("Est: " + est);
+    println("LB:  " + lb);
     println("");
   }
 
   @Test
   public void printlnTest() {
-    println("PRINTING: "+this.getClass().getName());
+    println("PRINTING: " + this.getClass().getName());
   }
 
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/BoundsOnBinomialProportionsTest.java b/src/test/java/org/apache/datasketches/BoundsOnBinomialProportionsTest.java
index bdab44e..8529ad3 100644
--- a/src/test/java/org/apache/datasketches/BoundsOnBinomialProportionsTest.java
+++ b/src/test/java/org/apache/datasketches/BoundsOnBinomialProportionsTest.java
@@ -37,51 +37,53 @@ import org.testng.annotations.Test;
 public class BoundsOnBinomialProportionsTest {
 
   @Test
-  public static void tinyLBTest () {
-    // these answers were computed using a different programming language and therefore might not match exactly.
-    double [] answers = {0.0, 0.004592032688529923, 0.04725537386564205,
-                         0.1396230607626959, 0.2735831034867167, 0.4692424353373485};
-    double kappa = 2.0;
-    assertTrue (0.0 == approximateLowerBoundOnP (0, 0, kappa));
-    long n = 5;
+  public static void tinyLBTest() {
+    //these answers were computed using a different programming language and therefore might not
+    // match exactly.
+    final double[] answers = {0.0, 0.004592032688529923, 0.04725537386564205,
+        0.1396230607626959, 0.2735831034867167, 0.4692424353373485};
+    final double kappa = 2.0;
+    assertTrue( 0.0 == approximateLowerBoundOnP(0, 0, kappa) );
+    final long n = 5;
     for (long k = 0; k <= n; k++) {
-      double lb = approximateLowerBoundOnP (n, k, kappa);
-      double est = estimateUnknownP (n, k);
-      assertTrue (lb <= est);
-      assertTrue (Math.abs (lb - answers[(int) k]) < 1e-14);
+      final double lb = approximateLowerBoundOnP(n, k, kappa);
+      final double est = estimateUnknownP(n, k);
+      assertTrue(lb <= est);
+      assertTrue(Math.abs(lb - answers[(int) k]) < 1e-14);
       //      System.out.printf ("LB\t%d\t%d\t%.1f\t%.16g%n", n, k, kappa, lb);
     }
   }
 
   @Test
-  public static void tinyUBTest () {
-    // these answers were computed using a different programming language and therefore might not match exactly.
-    double [] answers =  {0.5307575646626514, 0.7264168965132833, 0.860376939237304,
-                       0.952744626134358, 0.9954079673114701, 1.0};
-    double kappa = 2.0;
-    assertTrue (1.0 == approximateUpperBoundOnP (0, 0, kappa));
-    long n = 5;
+  public static void tinyUBTest() {
+    //these answers were computed using a different programming language and therefore might not
+    // match exactly.
+    final double[] answers = {0.5307575646626514, 0.7264168965132833, 0.860376939237304,
+        0.952744626134358, 0.9954079673114701, 1.0};
+    final double kappa = 2.0;
+    assertTrue(1.0 == approximateUpperBoundOnP(0, 0, kappa));
+    final long n = 5;
     for (long k = 0; k <= n; k++) {
-      double ub = approximateUpperBoundOnP (n, k, kappa);
-      double est = estimateUnknownP (n, k);
-      assertTrue (ub >= est);
-      assertTrue (Math.abs (ub - answers[(int) k]) < 1e-14);
+      final double ub = approximateUpperBoundOnP(n, k, kappa);
+      final double est = estimateUnknownP(n, k);
+      assertTrue(ub >= est);
+      assertTrue(Math.abs(ub - answers[(int) k]) < 1e-14);
       //      System.out.printf ("UB\t%d\t%d\t%.1f\t%.16g%n", n, k, kappa, ub);
     }
   }
 
   // This is for Kevin's use only, and will not be one of the unit tests.
-  public static void lotsOfSpewage (long maxN) {
+  public static void lotsOfSpewage(final long maxN) {
     for (long n = 0; n <= maxN; n++) {
       for (long k = 0; k <= n; k++) {
         for (double kappa = 0.5; kappa < 5.0; kappa += 0.5) {
-          double lb = approximateLowerBoundOnP (n, k, kappa);
-          double ub = approximateUpperBoundOnP (n, k, kappa);
-          double est = estimateUnknownP (n, k);
-          assertTrue (lb <= est);
-          assertTrue (ub >= est);
-          String slb = String.format("LB\t%d\t%d\t%.1f\t%.16g%n", n, k, kappa, lb);
-          String sub = String.format("UB\t%d\t%d\t%.1f\t%.16g%n", n, k, kappa, ub);
+          final double lb = approximateLowerBoundOnP(n, k, kappa);
+          final double ub = approximateUpperBoundOnP(n, k, kappa);
+          final double est = estimateUnknownP(n, k);
+          assertTrue(lb <= est);
+          assertTrue(ub >= est);
+          final String slb = String.format("LB\t%d\t%d\t%.1f\t%.16g%n", n, k, kappa, lb);
+          final String sub = String.format("UB\t%d\t%d\t%.1f\t%.16g%n", n, k, kappa, ub);
           println(slb);
           println(sub);
         }
@@ -90,29 +92,29 @@ public class BoundsOnBinomialProportionsTest {
   }
 
   // This is for Kevin's use only, and will not be one of the unit tests.
-  public static void printSomeNormalCDF () {
-    double [] someX = {-10.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 10.0};
+  public static void printSomeNormalCDF() {
+    final double[] someX = {-10.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 10.0};
     for (int i = 0; i < 11; i++) {
-      String s = String.format("normalCDF(%.1f) = %.12f%n", someX[i], normalCDF(someX[i]));
+      final String s = String.format("normalCDF(%.1f) = %.12f%n", someX[i], normalCDF(someX[i]));
       println(s);
     }
   }
 
   // This is for Kevin's use only, and will not be one of the unit tests.
-//  public static void main (String[] args) {
-//    tinyLBTest ();
-//    tinyUBTest ();
-//    assertTrue (args.length == 1);
-//    long maxN = Long.parseLong(args[0]);
-//    lotsOfSpewage (maxN);
-//  }
+  //  public static void main (String[] args) {
+  //    tinyLBTest ();
+  //    tinyUBTest ();
+  //    assertTrue (args.length == 1);
+  //    long maxN = Long.parseLong(args[0]);
+  //    lotsOfSpewage (maxN);
+  //  }
 
   @Test
   public static void checkNumStdDevZero() {
-    double lb = BoundsOnBinomialProportions.approximateLowerBoundOnP( 1000, 100, 0.0);
-    double ub = BoundsOnBinomialProportions.approximateUpperBoundOnP( 1000, 100, 0.0);
-    println("LB: "+lb);
-    println("UB: "+ub);
+    final double lb = BoundsOnBinomialProportions.approximateLowerBoundOnP( 1000, 100, 0.0);
+    final double ub = BoundsOnBinomialProportions.approximateUpperBoundOnP( 1000, 100, 0.0);
+    println("LB: " + lb);
+    println("UB: " + ub);
   }
 
   @Test
@@ -121,21 +123,21 @@ public class BoundsOnBinomialProportionsTest {
       estimateUnknownP(-1, 50);
       fail("Should have thrown SketchesArgumentException.");
     }
-    catch (SketchesArgumentException e) {
+    catch (final SketchesArgumentException e) {
       //expected
     }
     try {
       estimateUnknownP(500, -50);
       fail("Should have thrown SketchesArgumentException.");
     }
-    catch (SketchesArgumentException e) {
+    catch (final SketchesArgumentException e) {
       //expected
     }
     try {
       estimateUnknownP(500, 5000);
       fail("Should have thrown SketchesArgumentException.");
     }
-    catch (SketchesArgumentException e) {
+    catch (final SketchesArgumentException e) {
       //expected
     }
     assertEquals(estimateUnknownP(0, 0), 0.5, 0.0);
@@ -149,13 +151,13 @@ public class BoundsOnBinomialProportionsTest {
 
   @Test
   public void printlnTest() {
-    println("PRINTING: "+this.getClass().getName());
+    println("PRINTING: " + this.getClass().getName());
   }
 
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/BoundsOnRatiosInThetaSketchedSetsTest.java b/src/test/java/org/apache/datasketches/BoundsOnRatiosInThetaSketchedSetsTest.java
index 2a0cffc..d1610b0 100644
--- a/src/test/java/org/apache/datasketches/BoundsOnRatiosInThetaSketchedSetsTest.java
+++ b/src/test/java/org/apache/datasketches/BoundsOnRatiosInThetaSketchedSetsTest.java
@@ -22,28 +22,27 @@ package org.apache.datasketches;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
-import org.testng.annotations.Test;
-
 import org.apache.datasketches.theta.CompactSketch;
 import org.apache.datasketches.theta.Intersection;
 import org.apache.datasketches.theta.Sketches;
 import org.apache.datasketches.theta.UpdateSketch;
+import org.testng.annotations.Test;
 
 @SuppressWarnings("javadoc")
 public class BoundsOnRatiosInThetaSketchedSetsTest {
 
   @Test
   public void checkNormalReturns() {
-    UpdateSketch skA = Sketches.updateSketchBuilder().build(); //4K
-    UpdateSketch skC = Sketches.updateSketchBuilder().build();
-    int uA = 10000;
-    int uC = 100000;
-    for (int i=0; i<uA; i++) { skA.update(i); }
-    for (int i=0; i<uC; i++) { skC.update(i+(uA/2)); }
-    Intersection inter = Sketches.setOperationBuilder().buildIntersection();
+    final UpdateSketch skA = Sketches.updateSketchBuilder().build(); //4K
+    final UpdateSketch skC = Sketches.updateSketchBuilder().build();
+    final int uA = 10000;
+    final int uC = 100000;
+    for (int i = 0; i < uA; i++) { skA.update(i); }
+    for (int i = 0; i < uC; i++) { skC.update(i + (uA / 2)); }
+    final Intersection inter = Sketches.setOperationBuilder().buildIntersection();
     inter.update(skA);
     inter.update(skC);
-    CompactSketch skB = inter.getResult();
+    final CompactSketch skB = inter.getResult();
 
     double est = BoundsOnRatiosInThetaSketchedSets.getEstimateOfBoverA(skA, skB);
     double lb = BoundsOnRatiosInThetaSketchedSets.getLowerBoundForBoverA(skA, skB);
@@ -51,45 +50,45 @@ public class BoundsOnRatiosInThetaSketchedSetsTest {
     assertTrue(ub > est);
     assertTrue(est > lb);
     assertEquals(est, 0.5, .03);
-    println("ub : "+ ub);
-    println("est: "+est);
-    println("lb : "+lb);
+    println("ub : " + ub);
+    println("est: " + est);
+    println("lb : " + lb);
     skA.reset(); //skA is now empty
     est = BoundsOnRatiosInThetaSketchedSets.getEstimateOfBoverA(skA, skB);
     lb = BoundsOnRatiosInThetaSketchedSets.getLowerBoundForBoverA(skA, skB);
     ub = BoundsOnRatiosInThetaSketchedSets.getUpperBoundForBoverA(skA, skB);
-    println("ub : "+ ub);
-    println("est: "+est);
-    println("lb : "+lb);
+    println("ub : " + ub);
+    println("est: " + est);
+    println("lb : " + lb);
     skC.reset(); //Now both are empty
     est = BoundsOnRatiosInThetaSketchedSets.getEstimateOfBoverA(skA, skC);
     lb = BoundsOnRatiosInThetaSketchedSets.getLowerBoundForBoverA(skA, skC);
     ub = BoundsOnRatiosInThetaSketchedSets.getUpperBoundForBoverA(skA, skC);
-    println("ub : "+ ub);
-    println("est: "+est);
-    println("lb : "+lb);
+    println("ub : " + ub);
+    println("est: " + est);
+    println("lb : " + lb);
   }
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkAbnormalReturns() {
-    UpdateSketch skA = Sketches.updateSketchBuilder().build(); //4K
-    UpdateSketch skC = Sketches.updateSketchBuilder().build();
-    int uA = 100000;
-    int uC = 10000;
-    for (int i=0; i<uA; i++) { skA.update(i); }
-    for (int i=0; i<uC; i++) { skC.update(i+(uA/2)); }
+    final UpdateSketch skA = Sketches.updateSketchBuilder().build(); //4K
+    final UpdateSketch skC = Sketches.updateSketchBuilder().build();
+    final int uA = 100000;
+    final int uC = 10000;
+    for (int i = 0; i < uA; i++) { skA.update(i); }
+    for (int i = 0; i < uC; i++) { skC.update(i + (uA / 2)); }
     BoundsOnRatiosInThetaSketchedSets.getEstimateOfBoverA(skA, skC);
   }
 
   @Test
   public void printlnTest() {
-    println("PRINTING: "+this.getClass().getName());
+    println("PRINTING: " + this.getClass().getName());
   }
 
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 }
diff --git a/src/test/java/org/apache/datasketches/ByteArrayUtilTest.java b/src/test/java/org/apache/datasketches/ByteArrayUtilTest.java
index b69ae0a..a372e67 100644
--- a/src/test/java/org/apache/datasketches/ByteArrayUtilTest.java
+++ b/src/test/java/org/apache/datasketches/ByteArrayUtilTest.java
@@ -51,10 +51,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutShortLE() {
-    byte[] arr = { 79, -93, 124, 117 };
-    short out1 = getShortLE(arr, 0);
-    short out2 = getShortLE(arr, 2);
-    byte[] arr2 = new byte[4];
+    final byte[] arr = { 79, -93, 124, 117 };
+    final short out1 = getShortLE(arr, 0);
+    final short out2 = getShortLE(arr, 2);
+    final byte[] arr2 = new byte[4];
     putShortLE(arr2, 0, out1);
     putShortLE(arr2, 2, out2);
     assertEquals(arr2, arr);
@@ -62,10 +62,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutShortBE() {
-    byte[] arr = { 79, -93, 124, 117 };
-    short out1 = getShortBE(arr, 0);
-    short out2 = getShortBE(arr, 2);
-    byte[] arr2 = new byte[4];
+    final byte[] arr = { 79, -93, 124, 117 };
+    final short out1 = getShortBE(arr, 0);
+    final short out2 = getShortBE(arr, 2);
+    final byte[] arr2 = new byte[4];
     putShortBE(arr2, 0, out1);
     putShortBE(arr2, 2, out2);
     assertEquals(arr2, arr);
@@ -73,10 +73,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutIntLE() {
-    byte[] arr = { 79, -93, 124, 117, -73, -100, -114, 77 };
-    int out1 = getIntLE(arr, 0);
-    int out2 = getIntLE(arr, 4);
-    byte[] arr2 = new byte[8];
+    final byte[] arr = { 79, -93, 124, 117, -73, -100, -114, 77 };
+    final int out1 = getIntLE(arr, 0);
+    final int out2 = getIntLE(arr, 4);
+    final byte[] arr2 = new byte[8];
     putIntLE(arr2, 0, out1);
     putIntLE(arr2, 4, out2);
     assertEquals(arr2, arr);
@@ -84,10 +84,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutIntBE() {
-    byte[] arr = { 79, -93, 124, 117, -73, -100, -114, 77 };
-    int out1 = getIntBE(arr, 0);
-    int out2 = getIntBE(arr, 4);
-    byte[] arr2 = new byte[8];
+    final byte[] arr = { 79, -93, 124, 117, -73, -100, -114, 77 };
+    final int out1 = getIntBE(arr, 0);
+    final int out2 = getIntBE(arr, 4);
+    final byte[] arr2 = new byte[8];
     putIntBE(arr2, 0, out1);
     putIntBE(arr2, 4, out2);
     assertEquals(arr2, arr);
@@ -96,10 +96,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutLongLE() {
-    byte[] arr = { 79, -93, 124, 117, -73, -100, -114, 77, 5, -95, -15, 41, -89, -124, -26, -87 };
-    long out1 = getLongLE(arr, 0);
-    long out2 = getLongLE(arr, 8);
-    byte[] arr2 = new byte[16];
+    final byte[] arr = { 79, -93, 124, 117, -73, -100, -114, 77, 5, -95, -15, 41, -89, -124, -26, -87 };
+    final long out1 = getLongLE(arr, 0);
+    final long out2 = getLongLE(arr, 8);
+    final byte[] arr2 = new byte[16];
     putLongLE(arr2, 0, out1);
     putLongLE(arr2, 8, out2);
     assertEquals(arr2, arr);
@@ -107,10 +107,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutLongBE() {
-    byte[] arr = { 79, -93, 124, 117, -73, -100, -114, 77, 5, -95, -15, 41, -89, -124, -26, -87 };
-    long out1 = getLongBE(arr, 0);
-    long out2 = getLongBE(arr, 8);
-    byte[] arr2 = new byte[16];
+    final byte[] arr = { 79, -93, 124, 117, -73, -100, -114, 77, 5, -95, -15, 41, -89, -124, -26, -87 };
+    final long out1 = getLongBE(arr, 0);
+    final long out2 = getLongBE(arr, 8);
+    final byte[] arr2 = new byte[16];
     putLongBE(arr2, 0, out1);
     putLongBE(arr2, 8, out2);
     assertEquals(arr2, arr);
@@ -118,10 +118,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutFloatLE() {
-    byte[] arr = { -37, 15, 73, 64, 84, -8, 45, 64 }; //PI, E
-    float out1 = getFloatLE(arr, 0);
-    float out2 = getFloatLE(arr, 4);
-    byte[] arr2 = new byte[8];
+    final byte[] arr = { -37, 15, 73, 64, 84, -8, 45, 64 }; //PI, E
+    final float out1 = getFloatLE(arr, 0);
+    final float out2 = getFloatLE(arr, 4);
+    final byte[] arr2 = new byte[8];
     putFloatLE(arr2, 0, out1);
     putFloatLE(arr2, 4, out2);
     assertEquals(arr2, arr);
@@ -131,10 +131,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutFloatBE() {
-    byte[] arr = { -37, 15, 73, 64, 84, -8, 45, 64 }; //PI, E
-    float out1 = getFloatBE(arr, 0);
-    float out2 = getFloatBE(arr, 4);
-    byte[] arr2 = new byte[8];
+    final byte[] arr = { -37, 15, 73, 64, 84, -8, 45, 64 }; //PI, E
+    final float out1 = getFloatBE(arr, 0);
+    final float out2 = getFloatBE(arr, 4);
+    final byte[] arr2 = new byte[8];
     putFloatBE(arr2, 0, out1);
     putFloatBE(arr2, 4, out2);
     assertEquals(arr2, arr);
@@ -142,10 +142,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutDoubleLE() {
-    byte[] arr = { 24, 45, 68, 84, -5, 33, 9, 64, 105, 87, 20, -117, 10, -65, 5, 64 }; //PI, E
-    double out1 = getDoubleLE(arr, 0);
-    double out2 = getDoubleLE(arr, 8);
-    byte[] arr2 = new byte[16];
+    final byte[] arr = { 24, 45, 68, 84, -5, 33, 9, 64, 105, 87, 20, -117, 10, -65, 5, 64 }; //PI, E
+    final double out1 = getDoubleLE(arr, 0);
+    final double out2 = getDoubleLE(arr, 8);
+    final byte[] arr2 = new byte[16];
     putDoubleLE(arr2, 0, out1);
     putDoubleLE(arr2, 8, out2);
     assertEquals(arr2, arr);
@@ -155,10 +155,10 @@ public class ByteArrayUtilTest {
 
   @Test
   public void checkGetPutDoubleBE() {
-    byte[] arr = { 24, 45, 68, 84, -5, 33, 9, 64, 105, 87, 20, -117, 10, -65, 5, 64 }; //PI, E
-    double out1 = getDoubleBE(arr, 0);
-    double out2 = getDoubleBE(arr, 8);
-    byte[] arr2 = new byte[16];
+    final byte[] arr = { 24, 45, 68, 84, -5, 33, 9, 64, 105, 87, 20, -117, 10, -65, 5, 64 }; //PI, E
+    final double out1 = getDoubleBE(arr, 0);
+    final double out2 = getDoubleBE(arr, 8);
+    final byte[] arr2 = new byte[16];
     putDoubleBE(arr2, 0, out1);
     putDoubleBE(arr2, 8, out2);
     assertEquals(arr2, arr);
diff --git a/src/test/java/org/apache/datasketches/FamilyTest.java b/src/test/java/org/apache/datasketches/FamilyTest.java
index cd996ab..38eb68e 100644
--- a/src/test/java/org/apache/datasketches/FamilyTest.java
+++ b/src/test/java/org/apache/datasketches/FamilyTest.java
@@ -34,18 +34,18 @@ public class FamilyTest {
 
   @Test
   public void checkFamilyEnum() {
-    Family[] families = Family.values();
-    int numFam = families.length;
+    final Family[] families = Family.values();
+    final int numFam = families.length;
 
-    for (int i=0; i<numFam; i++) {
-      Family f = families[i];
-      int fid = f.getID();
+    for (int i = 0; i < numFam; i++) {
+      final Family f = families[i];
+      final int fid = f.getID();
       f.checkFamilyID(fid);
 
-      Family f2 = idToFamily(fid);
+      final Family f2 = idToFamily(fid);
       assertTrue(f.equals(f2));
       assertEquals(f.getFamilyName(), f2.getFamilyName());
-      int id2 = f2.getID();
+      final int id2 = f2.getID();
       assertEquals(fid, id2);
     }
     checkStringToFamily("Alpha");
@@ -57,8 +57,8 @@ public class FamilyTest {
     checkStringToFamily("Quantiles");
   }
 
-  private static void checkStringToFamily(String inStr) {
-    String fName = stringToFamily(inStr).toString();
+  private static void checkStringToFamily(final String inStr) {
+    final String fName = stringToFamily(inStr).toString();
     assertEquals(fName, inStr.toUpperCase());
   }
 
@@ -69,20 +69,20 @@ public class FamilyTest {
 
   @Test(expectedExceptions = SketchesArgumentException.class)
   public void checkBadFamilyID() {
-    Family famAlpha = Family.ALPHA;
-    Family famQS = Family.QUICKSELECT;
+    final Family famAlpha = Family.ALPHA;
+    final Family famQS = Family.QUICKSELECT;
     famAlpha.checkFamilyID(famQS.getID());
   }
 
   @Test
   public void printlnTest() {
-    println("PRINTING: "+this.getClass().getName());
+    println("PRINTING: " + this.getClass().getName());
   }
 
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/HashOperationsTest.java b/src/test/java/org/apache/datasketches/HashOperationsTest.java
index 81d91ba..00c34fa 100644
--- a/src/test/java/org/apache/datasketches/HashOperationsTest.java
+++ b/src/test/java/org/apache/datasketches/HashOperationsTest.java
@@ -34,9 +34,8 @@ import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
-import org.testng.annotations.Test;
-
 import org.apache.datasketches.memory.WritableMemory;
+import org.testng.annotations.Test;
 
 @SuppressWarnings("javadoc")
 public class HashOperationsTest {
@@ -65,13 +64,13 @@ public class HashOperationsTest {
 
   @Test
   public void checkHashArrayInsert() {
-    long[] hTable = new long[16];
-    long[] hashIn = new long[1];
-    for (int i=0; i<8; i++) {
+    final long[] hTable = new long[16];
+    final long[] hashIn = new long[1];
+    for (int i = 0; i < 8; i++) {
       hashIn[0] = i;
-      long h = hash(hashIn, 0)[0] >>> 1;
+      final long h = hash(hashIn, 0)[0] >>> 1;
       hashInsertOnly(hTable, 4, h);
-      int count = hashArrayInsert(hTable, hTable, 4, Long.MAX_VALUE);
+      final int count = hashArrayInsert(hTable, hTable, 4, Long.MAX_VALUE);
       assertEquals(count, 0);
     }
 
@@ -79,52 +78,52 @@ public class HashOperationsTest {
 
   @Test
   public void testContinueCondtion() {
-    long thetaLong = Long.MAX_VALUE/2;
+    final long thetaLong = Long.MAX_VALUE / 2;
     assertTrue(continueCondition(thetaLong, 0));
     assertTrue(continueCondition(thetaLong, thetaLong));
-    assertTrue(continueCondition(thetaLong, thetaLong +1));
-    assertFalse(continueCondition(thetaLong, thetaLong -1));
+    assertTrue(continueCondition(thetaLong, thetaLong + 1));
+    assertFalse(continueCondition(thetaLong, thetaLong - 1));
   }
 
   @Test
   public void testHashInsertOnlyNoStride() {
-    long[] table = new long[32];
-    int index = hashInsertOnly(table, 5, 1);
+    final long[] table = new long[32];
+    final int index = hashInsertOnly(table, 5, 1);
     assertEquals(index, 1);
     assertEquals(table[1], 1L);
   }
 
   @Test
   public void testHashInsertOnlyWithStride() {
-    long[] table = new long[32];
+    final long[] table = new long[32];
     table[1] = 1;
-    int index = hashInsertOnly(table, 5, 1);
+    final int index = hashInsertOnly(table, 5, 1);
     assertEquals(index, 2);
     assertEquals(table[2], 1L);
   }
 
   @Test
   public void testHashInsertOnlyMemoryNoStride() {
-    long[] table = new long[32];
-    WritableMemory mem = WritableMemory.wrap(table);
-    int index = fastHashInsertOnly(mem, 5, 1, 0);
+    final long[] table = new long[32];
+    final WritableMemory mem = WritableMemory.wrap(table);
+    final int index = fastHashInsertOnly(mem, 5, 1, 0);
     assertEquals(index, 1);
     assertEquals(table[1], 1L);
   }
 
   @Test
   public void testHashInsertOnlyMemoryWithStride() {
-    long[] table = new long[32];
+    final long[] table = new long[32];
     table[1] = 1;
-    WritableMemory mem = WritableMemory.wrap(table);
-    int index = fastHashInsertOnly(mem, 5, 1, 0);
+    final WritableMemory mem = WritableMemory.wrap(table);
+    final int index = fastHashInsertOnly(mem, 5, 1, 0);
     assertEquals(index, 2);
     assertEquals(table[2], 1L);
   }
 
   @Test
   public void checkFullHeapTableCatchesInfiniteLoop() {
-    long[] table = new long[32];
+    final long[] table = new long[32];
     for (int i = 1; i <= 32; ++i) {
       hashInsertOnly(table, 5, i);
     }
@@ -150,8 +149,8 @@ public class HashOperationsTest {
 
   @Test
   public void checkFullDirectTableCatchesInfiniteLoop() {
-    long[] table = new long[32];
-    WritableMemory mem = WritableMemory.wrap(table);
+    final long[] table = new long[32];
+    final WritableMemory mem = WritableMemory.wrap(table);
     for (int i = 1; i <= 32; ++i) {
       fastHashInsertOnly(mem, 5, i, 0);
     }
@@ -177,8 +176,8 @@ public class HashOperationsTest {
 
   @Test
   public void checkFullFastDirectTableCatchesInfiniteLoop() {
-    long[] table = new long[32];
-    WritableMemory wmem = WritableMemory.wrap(table);
+    final long[] table = new long[32];
+    final WritableMemory wmem = WritableMemory.wrap(table);
 
     for (int i = 1; i <= 32; ++i) {
       fastHashInsertOnly(wmem, 5, i, 0);
@@ -203,13 +202,13 @@ public class HashOperationsTest {
 
   @Test
   public void printlnTest() {
-    println("PRINTING: "+this.getClass().getName());
+    println("PRINTING: " + this.getClass().getName());
   }
 
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/QuickSelectTest.java b/src/test/java/org/apache/datasketches/QuickSelectTest.java
index ca9766e..4414c26 100644
--- a/src/test/java/org/apache/datasketches/QuickSelectTest.java
+++ b/src/test/java/org/apache/datasketches/QuickSelectTest.java
@@ -19,10 +19,10 @@
 
 package org.apache.datasketches;
 
+import static java.lang.String.format;
 import static org.apache.datasketches.QuickSelect.select;
 import static org.apache.datasketches.QuickSelect.selectExcludingZeros;
 import static org.apache.datasketches.QuickSelect.selectIncludingZeros;
-import static java.lang.String.format;
 
 import java.util.Random;
 
@@ -41,16 +41,16 @@ public class QuickSelectTest {
 
   @Test
   public void checkQuickSelect0Based() {
-    int len = 64;
-    long[] arr = new long[len];
+    final int len = 64;
+    final long[] arr = new long[len];
     for (int i = 0; i < len; i++ ) {
       arr[i] = i;
     }
     for (int pivot = 0; pivot < 64; pivot++ ) {
-      long trueVal = pivot;
+      final long trueVal = pivot;
       for (int i = 0; i < 1000; i++ ) {
         shuffle(arr);
-        long retVal = select(arr, 0, len - 1, pivot);
+        final long retVal = select(arr, 0, len - 1, pivot);
         Assert.assertEquals(retVal, trueVal);
       }
     }
@@ -58,45 +58,45 @@ public class QuickSelectTest {
 
   @Test
   public void checkQuickSelect1BasedExcludingZeros() {
-    int len = 64;
-    int nonZeros = (7 * len) / 8;
-    long[] arr = new long[len];
+    final int len = 64;
+    final int nonZeros = (7 * len) / 8;
+    final long[] arr = new long[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
-    int pivot = len / 2;
-    long trueVal = arr[pivot - 1];
+    final int pivot = len / 2;
+    final long trueVal = arr[pivot - 1];
     shuffle(arr);
-    long retVal = selectExcludingZeros(arr, nonZeros, pivot);
+    final long retVal = selectExcludingZeros(arr, nonZeros, pivot);
     Assert.assertEquals(retVal, trueVal);
   }
 
   @Test
   public void checkQuickSelect1BasedExcludingZeros2() {
-    int len = 64;
-    int nonZeros = 16;
-    long[] arr = new long[len];
+    final int len = 64;
+    final int nonZeros = 16;
+    final long[] arr = new long[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
     shuffle(arr);
-    int pivot = len / 2;
-    long retVal = selectExcludingZeros(arr, nonZeros, pivot);
+    final int pivot = len / 2;
+    final long retVal = selectExcludingZeros(arr, nonZeros, pivot);
     Assert.assertEquals(retVal, 0);
   }
 
   @Test
   public void checkQuickSelect1BasedIncludingZeros() {
-    int len = 64;
-    int zeros = len / 8;
-    long[] arr = new long[len];
+    final int len = 64;
+    final int zeros = len / 8;
+    final long[] arr = new long[len];
     for (int i = zeros; i < len; i++ ) {
       arr[i] = i + 1;
     }
-    int pivot = len / 2;
-    long trueVal = arr[pivot - 1];
+    final int pivot = len / 2;
+    final long trueVal = arr[pivot - 1];
     shuffle(arr);
-    long retVal = selectIncludingZeros(arr, pivot);
+    final long retVal = selectIncludingZeros(arr, pivot);
     Assert.assertEquals(retVal, trueVal);
   }
 
@@ -104,16 +104,16 @@ public class QuickSelectTest {
 
   @Test
   public void checkQuickSelectDbl0Based() {
-    int len = 64;
-    double[] arr = new double[len];
+    final int len = 64;
+    final double[] arr = new double[len];
     for (int i = 0; i < len; i++ ) {
       arr[i] = i;
     }
     for (int pivot = 0; pivot < 64; pivot++ ) {
-      double trueVal = pivot;
+      final double trueVal = pivot;
       for (int i = 0; i < 1000; i++ ) {
         shuffle(arr);
-        double retVal = select(arr, 0, len - 1, pivot);
+        final double retVal = select(arr, 0, len - 1, pivot);
         Assert.assertEquals(retVal, trueVal, 0.0);
       }
     }
@@ -121,45 +121,45 @@ public class QuickSelectTest {
 
   @Test
   public void checkQuickSelectDbl1BasedExcludingZeros() {
-    int len = 64;
-    int nonZeros = (7 * len) / 8;
-    double[] arr = new double[len];
+    final int len = 64;
+    final int nonZeros = (7 * len) / 8;
+    final double[] arr = new double[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
-    int pivot = len / 2;
-    double trueVal = arr[pivot - 1];
+    final int pivot = len / 2;
+    final double trueVal = arr[pivot - 1];
     shuffle(arr);
-    double retVal = selectExcludingZeros(arr, nonZeros, pivot);
+    final double retVal = selectExcludingZeros(arr, nonZeros, pivot);
     Assert.assertEquals(retVal, trueVal, 0.0);
   }
 
   @Test
   public void checkQuickSelectDbl1BasedExcludingZeros2() {
-    int len = 64;
-    int nonZeros = 16;
-    double[] arr = new double[len];
+    final int len = 64;
+    final int nonZeros = 16;
+    final double[] arr = new double[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
     shuffle(arr);
-    int pivot = len / 2;
-    double retVal = selectExcludingZeros(arr, nonZeros, pivot);
+    final int pivot = len / 2;
+    final double retVal = selectExcludingZeros(arr, nonZeros, pivot);
     Assert.assertEquals(retVal, 0, 0.0);
   }
 
   @Test
   public void checkQuickSelectDbl1BasedIncludingZeros() {
-    int len = 64;
-    int zeros = len / 8;
-    double[] arr = new double[len];
+    final int len = 64;
+    final int zeros = len / 8;
+    final double[] arr = new double[len];
     for (int i = zeros; i < len; i++ ) {
       arr[i] = i + 1;
     }
-    int pivot = len / 2;
-    double trueVal = arr[pivot -1];
+    final int pivot = len / 2;
+    final double trueVal = arr[pivot - 1];
     shuffle(arr);
-    double retVal = selectIncludingZeros(arr, pivot);
+    final double retVal = selectIncludingZeros(arr, pivot);
     Assert.assertEquals(retVal, trueVal, 0.0);
   }
 
@@ -168,11 +168,11 @@ public class QuickSelectTest {
    * Rearrange the elements of an array in random order.
    * @param a long array
    */
-  public static void shuffle(long[] a) {
-    int N = a.length;
+  public static void shuffle(final long[] a) {
+    final int N = a.length;
     for (int i = 0; i < N; i++ ) {
-      int r = i + uniform(N - i); // between i and N-1
-      long temp = a[i];
+      final int r = i + uniform(N - i); // between i and N-1
+      final long temp = a[i];
       a[i] = a[r];
       a[r] = temp;
     }
@@ -182,11 +182,11 @@ public class QuickSelectTest {
    * Rearrange the elements of an array in random order.
    * @param a double array
    */
-  public static void shuffle(double[] a) {
-    int N = a.length;
+  public static void shuffle(final double[] a) {
+    final int N = a.length;
     for (int i = 0; i < N; i++ ) {
-      int r = i + uniform(N - i); // between i and N-1
-      double temp = a[i];
+      final int r = i + uniform(N - i); // between i and N-1
+      final double temp = a[i];
       a[i] = a[r];
       a[r] = temp;
     }
@@ -199,16 +199,16 @@ public class QuickSelectTest {
    * @param n the upper exclusive bound
    * @return random integer
    */
-  public static int uniform(int n) {
+  public static int uniform(final int n) {
     if (n <= 0) {
       throw new SketchesArgumentException("n must be positive");
     }
     return random.nextInt(n);
   }
 
-  private static String printArr(long[] arr) {
-    StringBuilder sb = new StringBuilder();
-    int len = arr.length;
+  private static String printArr(final long[] arr) {
+    final StringBuilder sb = new StringBuilder();
+    final int len = arr.length;
     sb.append(" Base0").append(" Base1").append(" Value").append(LS);
     for (int i = 0; i < len; i++ ) {
       sb
@@ -218,9 +218,9 @@ public class QuickSelectTest {
     return sb.toString();
   }
 
-  private static String printArr(double[] arr) {
-    StringBuilder sb = new StringBuilder();
-    int len = arr.length;
+  private static String printArr(final double[] arr) {
+    final StringBuilder sb = new StringBuilder();
+    final int len = arr.length;
     sb.append(" Base0").append(" Base1").append("    Value").append(LS);
     for (int i = 0; i < len; i++ ) {
       sb
@@ -232,10 +232,10 @@ public class QuickSelectTest {
 
   //For console testing
   static void test1() {
-    int len = 16;
-    int nonZeros = (3 * len) / 4;
-    int zeros = len - nonZeros;
-    long[] arr = new long[len];
+    final int len = 16;
+    final int nonZeros = (3 * len) / 4;
+    final int zeros = len - nonZeros;
+    final long[] arr = new long[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
@@ -244,26 +244,26 @@ public class QuickSelectTest {
     shuffle(arr);
     println("Randomized Ordering:");
     println(printArr(arr));
-    int pivot = len / 2;
+    final int pivot = len / 2;
     println("select(...):");
     println("ArrSize : " + len);
     println("NonZeros: " + nonZeros);
     println("Zeros   : " + zeros);
     println("Choose pivot at 1/2 array size, pivot: " + pivot);
-    long ret = select(arr, 0, len - 1, pivot);
+    final long ret = select(arr, 0, len - 1, pivot);
     println("Return value of 0-based pivot including zeros:");
     println("select(arr, 0, " + (len - 1) + ", " + pivot + ") => " + ret);
     println("0-based index of pivot = pivot = " + (pivot));
-    println("Result Array:"+LS);
+    println("Result Array:" + LS);
     println(printArr(arr));
   }
 
   //For console testing
   static void test2() {
-    int len = 16;
-    int nonZeros = (3 * len) / 4;
-    int zeros = len - nonZeros;
-    long[] arr = new long[len];
+    final int len = 16;
+    final int nonZeros = (3 * len) / 4;
+    final int zeros = len - nonZeros;
+    final long[] arr = new long[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
@@ -272,26 +272,26 @@ public class QuickSelectTest {
     shuffle(arr);
     println("Randomized Ordering:");
     println(printArr(arr));
-    int pivot = len / 2; //= 8
+    final int pivot = len / 2; //= 8
     println("selectDiscountingZeros(...):");
     println("ArrSize : " + len);
     println("NonZeros: " + nonZeros);
     println("Zeros   : " + zeros);
     println("Choose pivot at 1/2 array size, pivot= " + pivot);
-    long ret = selectExcludingZeros(arr, nonZeros, pivot);
+    final long ret = selectExcludingZeros(arr, nonZeros, pivot);
     println("Return value of 1-based pivot discounting zeros:");
     println("selectDiscountingZeros(arr, " + nonZeros + ", " + pivot + ") => " + ret);
     println("0-based index of pivot= pivot+zeros-1 = " + ((pivot + zeros) - 1));
-    println("Result Array:"+LS);
+    println("Result Array:" + LS);
     println(printArr(arr));
   }
 
   //For console testing
   static void test3() {
-    int len = 16;
-    int nonZeros = (3 * len) / 4;
-    int zeros = len - nonZeros;
-    long[] arr = new long[len];
+    final int len = 16;
+    final int nonZeros = (3 * len) / 4;
+    final int zeros = len - nonZeros;
+    final long[] arr = new long[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
@@ -300,25 +300,25 @@ public class QuickSelectTest {
     shuffle(arr);
     println("Randomized Ordering:");
     println(printArr(arr));
-    int pivot = len / 2; //= 8
+    final int pivot = len / 2; //= 8
     println("selectIncludingZeros(...):");
     println("ArrSize : " + len);
     println("NonZeros: " + nonZeros);
     println("Zeros   : " + zeros);
     println("Choose pivot at 1/2 array size, pivot= " + pivot);
-    long ret = selectIncludingZeros(arr, pivot);
+    final long ret = selectIncludingZeros(arr, pivot);
     println("Return value of 1-based pivot including zeros:");
     println("selectIncludingZeros(arr, " + pivot + ") => " + ret);
     println("0-based index of pivot= pivot-1 = " + (pivot - 1));
-    println("Result Array:"+LS);
+    println("Result Array:" + LS);
     println(printArr(arr));
   }
 
   static void testDbl1() {
-    int len = 16;
-    int nonZeros = (3 * len) / 4;
-    int zeros = len - nonZeros;
-    double[] arr = new double[len];
+    final int len = 16;
+    final int nonZeros = (3 * len) / 4;
+    final int zeros = len - nonZeros;
+    final double[] arr = new double[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
@@ -327,26 +327,26 @@ public class QuickSelectTest {
     shuffle(arr);
     println("Randomized Ordering:");
     println(printArr(arr));
-    int pivot = len / 2;
+    final int pivot = len / 2;
     println("select(...):");
     println("ArrSize : " + len);
     println("NonZeros: " + nonZeros);
     println("Zeros   : " + zeros);
     println("Choose pivot at 1/2 array size, pivot: " + pivot);
-    double ret = select(arr, 0, len - 1, pivot);
+    final double ret = select(arr, 0, len - 1, pivot);
     println("Return value of 0-based pivot including zeros:");
     println("select(arr, 0, " + (len - 1) + ", " + pivot + ") => " + ret);
     println("0-based index of pivot = pivot = " + (pivot));
-    println("Result Array:"+LS);
+    println("Result Array:" + LS);
     println(printArr(arr));
   }
 
   //For console testing
   static void testDbl2() {
-    int len = 16;
-    int nonZeros = (3 * len) / 4;
-    int zeros = len - nonZeros;
-    double[] arr = new double[len];
+    final int len = 16;
+    final int nonZeros = (3 * len) / 4;
+    final int zeros = len - nonZeros;
+    final double[] arr = new double[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
@@ -355,26 +355,26 @@ public class QuickSelectTest {
     shuffle(arr);
     println("Randomized Ordering:");
     println(printArr(arr));
-    int pivot = len / 2; //= 8
+    final int pivot = len / 2; //= 8
     println("selectDiscountingZeros(...):");
     println("ArrSize : " + len);
     println("NonZeros: " + nonZeros);
     println("Zeros   : " + zeros);
     println("Choose pivot at 1/2 array size, pivot= " + pivot);
-    double ret = selectExcludingZeros(arr, nonZeros, pivot);
+    final double ret = selectExcludingZeros(arr, nonZeros, pivot);
     println("Return value of 1-based pivot discounting zeros:");
     println("selectDiscountingZeros(arr, " + nonZeros + ", " + pivot + ") => " + ret);
     println("0-based index of pivot= pivot+zeros-1 = " + ((pivot + zeros) - 1));
-    println("Result Array:"+LS);
+    println("Result Array:" + LS);
     println(printArr(arr));
   }
 
   //For console testing
   static void testDbl3() {
-    int len = 16;
-    int nonZeros = (3 * len) / 4;
-    int zeros = len - nonZeros;
-    double[] arr = new double[len];
+    final int len = 16;
+    final int nonZeros = (3 * len) / 4;
+    final int zeros = len - nonZeros;
+    final double[] arr = new double[len];
     for (int i = 0; i < nonZeros; i++ ) {
       arr[i] = i + 1;
     }
@@ -383,63 +383,63 @@ public class QuickSelectTest {
     shuffle(arr);
     println("Randomized Ordering:");
     println(printArr(arr));
-    int pivot = len / 2; //= 8
+    final int pivot = len / 2; //= 8
     println("selectIncludingZeros(...):");
     println("ArrSize : " + len);
     println("NonZeros: " + nonZeros);
     println("Zeros   : " + zeros);
     println("Choose pivot at 1/2 array size, pivot= " + pivot);
-    double ret = selectIncludingZeros(arr, pivot);
+    final double ret = selectIncludingZeros(arr, pivot);
     println("Return value of 1-based pivot including zeros:");
     println("selectIncludingZeros(arr, " + pivot + ") => " + ret);
     println("0-based index of pivot= pivot-1 = " + (pivot - 1));
-    println("Result Array:"+LS);
+    println("Result Array:" + LS);
     println(printArr(arr));
   }
 
-//  public static void main(String[] args) {
-//    println(LS+"==LONGS 1=========="+LS);
-//    test1();
-//    println(LS+"==LONGS 2=========="+LS);
-//    test2();
-//    println(LS+"==LONGS 3=========="+LS);
-//    test3();
-//    println(LS+"==DOUBLES 1========"+LS);
-//    testDbl1();
-//    println(LS+"==DOUBLES 2========"+LS);
-//    testDbl2();
-//    println(LS+"==DOUBLES 3========"+LS);
-//    testDbl3();
-//
-//
-//    QuickSelectTest qst = new QuickSelectTest();
-//    qst.checkQuickSelect0Based();
-//    qst.checkQuickSelect1BasedExcludingZeros();
-//    qst.checkQuickSelect1BasedExcludingZeros2();
-//    qst.checkQuickSelect1BasedIncludingZeros();
-//    qst.checkQuickSelectDbl0Based();
-//    qst.checkQuickSelectDbl1BasedExcludingZeros();
-//    qst.checkQuickSelectDbl1BasedExcludingZeros2();
-//    qst.checkQuickSelectDbl1BasedIncludingZeros();
-//
-//  }
+  //  public static void main(String[] args) {
+  //    println(LS+"==LONGS 1=========="+LS);
+  //    test1();
+  //    println(LS+"==LONGS 2=========="+LS);
+  //    test2();
+  //    println(LS+"==LONGS 3=========="+LS);
+  //    test3();
+  //    println(LS+"==DOUBLES 1========"+LS);
+  //    testDbl1();
+  //    println(LS+"==DOUBLES 2========"+LS);
+  //    testDbl2();
+  //    println(LS+"==DOUBLES 3========"+LS);
+  //    testDbl3();
+  //
+  //
+  //    QuickSelectTest qst = new QuickSelectTest();
+  //    qst.checkQuickSelect0Based();
+  //    qst.checkQuickSelect1BasedExcludingZeros();
+  //    qst.checkQuickSelect1BasedExcludingZeros2();
+  //    qst.checkQuickSelect1BasedIncludingZeros();
+  //    qst.checkQuickSelectDbl0Based();
+  //    qst.checkQuickSelectDbl1BasedExcludingZeros();
+  //    qst.checkQuickSelectDbl1BasedExcludingZeros2();
+  //    qst.checkQuickSelectDbl1BasedIncludingZeros();
+  //
+  //  }
 
   @Test
   public void printlnTest() {
-    println("PRINTING: "+this.getClass().getName());
+    println("PRINTING: " + this.getClass().getName());
   }
 
   /**
    * @param s value to print
    */
-  static void println(String s) {
+  static void println(final String s) {
     //System.out.println(s); //disable here
   }
 
   /**
    * @param d value to print
    */
-  static void println(double d) {
+  static void println(final double d) {
     //System.out.println(d); //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/SketchesExceptionTest.java b/src/test/java/org/apache/datasketches/SketchesExceptionTest.java
index ca852c9..acd95af 100644
--- a/src/test/java/org/apache/datasketches/SketchesExceptionTest.java
+++ b/src/test/java/org/apache/datasketches/SketchesExceptionTest.java
@@ -43,10 +43,10 @@ public class SketchesExceptionTest {
   public void checkSketchesExceptionWithThrowable() {
     try {
       throw new SketchesException("First Exception.");
-    } catch (SketchesException se) {
+    } catch (final SketchesException se) {
       try {
         throw new SketchesException("Second Exception. ", se);
-      } catch (SketchesException se2) {
+      } catch (final SketchesException se2) {
         //success
       }
     }
diff --git a/src/test/java/org/apache/datasketches/UtilTest.java b/src/test/java/org/apache/datasketches/UtilTest.java
index 4072f84..c4fea7c 100644
--- a/src/test/java/org/apache/datasketches/UtilTest.java
+++ b/src/test/java/org/apache/datasketches/UtilTest.java
@@ -85,7 +85,7 @@ public class UtilTest {
       checkIfPowerOf2(7, "Test 7");
       Assert.fail("Expected SketchesArgumentException");
     }
-    catch (SketchesArgumentException e) {
+    catch (final SketchesArgumentException e) {
       //pass
     }
   }
@@ -159,10 +159,10 @@ public class UtilTest {
 
   @Test
   public void checkIsLessThanUnsigned() {
-    long n1 = 1;
-    long n2 = 3;
-    long n3 = -3;
-    long n4 = -1;
+    final long n1 = 1;
+    final long n2 = 3;
+    final long n3 = -3;
+    final long n4 = -1;
     Assert.assertTrue(isLessThanUnsigned(n1, n2));
     Assert.assertTrue(isLessThanUnsigned(n2, n3));
     Assert.assertTrue(isLessThanUnsigned(n3, n4));
@@ -173,16 +173,16 @@ public class UtilTest {
 
   @Test
   public void checkZeroPad() {
-    long v = 123456789;
-    String vHex = Long.toHexString(v);
-    String out = zeroPad(vHex, 16);
+    final long v = 123456789;
+    final String vHex = Long.toHexString(v);
+    final String out = zeroPad(vHex, 16);
     println("Pad 16, prepend 0: " + out);
   }
 
   @Test
   public void checkCharacterPad() {
-    String s = "Pad 30, postpend z:";
-    String out = characterPad(s, 30, 'z', true);
+    final String s = "Pad 30, postpend z:";
+    final String out = characterPad(s, 30, 'z', true);
     println(out);
   }
 
@@ -203,10 +203,10 @@ public class UtilTest {
 
   @Test
   public void checkEvenlyLgSpaced() {
-    int lgStart = 0;
-    int lgEnd = 4;
-    int ppo = 1;
-    int points = (ppo * (lgEnd - lgStart)) +1;
+    final int lgStart = 0;
+    final int lgEnd = 4;
+    final int ppo = 1;
+    final int points = (ppo * (lgEnd - lgStart)) + 1;
     int[] pts = evenlyLgSpaced(lgStart, lgEnd, points);
     Assert.assertEquals(pts[0], 1);
     Assert.assertEquals(pts[1], 2);
@@ -229,32 +229,32 @@ public class UtilTest {
 
   @Test
   public void checkBytesToInt() {
-    byte[] arr = new byte[] {4, 3, 2, 1};
-    int result = 4 + (3 << 8) + (2 << 16) + (1 << 24);
+    final byte[] arr = new byte[] {4, 3, 2, 1};
+    final int result = 4 + (3 << 8) + (2 << 16) + (1 << 24);
     Assert.assertEquals(bytesToInt(arr), result);
-    byte[] arr2 = intToBytes(result, new byte[4]);
+    final byte[] arr2 = intToBytes(result, new byte[4]);
     Assert.assertEquals(arr, arr2);
   }
 
   @Test
   public void checkBytesToLong() {
-    byte[] arr = new byte[] {8, 7, 6, 5, 4, 3, 2, 1};
-    long result = 8L + (7L << 8) + (6L << 16) + (5L << 24)
+    final byte[] arr = new byte[] {8, 7, 6, 5, 4, 3, 2, 1};
+    final long result = 8L + (7L << 8) + (6L << 16) + (5L << 24)
                + (4L << 32) + (3L << 40) + (2L << 48) + (1L << 56);
     Assert.assertEquals(bytesToLong(arr), result);
   }
 
   @Test
   public void checkBytesToString() {
-    long lng = 0XF8F7F6F504030201L;
+    final long lng = 0XF8F7F6F504030201L;
     //println(Long.toHexString(lng));
     byte[] bytes = new byte[8];
     bytes = Util.longToBytes(lng, bytes);
-    String sep = ".";
-    String unsignLE = bytesToString(bytes, false, true, sep);
-    String signedLE = bytesToString(bytes, true, true, sep);
-    String unsignBE = bytesToString(bytes, false,  false, sep);
-    String signedBE = bytesToString(bytes, true,  false, sep);
+    final String sep = ".";
+    final String unsignLE = bytesToString(bytes, false, true, sep);
+    final String signedLE = bytesToString(bytes, true, true, sep);
+    final String unsignBE = bytesToString(bytes, false,  false, sep);
+    final String signedBE = bytesToString(bytes, true,  false, sep);
     Assert.assertEquals(unsignLE, "1.2.3.4.245.246.247.248");
     Assert.assertEquals(signedLE, "1.2.3.4.-11.-10.-9.-8");
     Assert.assertEquals(unsignBE, "248.247.246.245.4.3.2.1");
@@ -263,17 +263,17 @@ public class UtilTest {
 
   @Test
   public void checkNsecToString() {
-    long nS = 1000000000L + 1000000L + 1000L + 1L;
-    String result = nanoSecToString(nS);
-    String expected = "1.001_001_001";
+    final long nS = 1000000000L + 1000000L + 1000L + 1L;
+    final String result = nanoSecToString(nS);
+    final String expected = "1.001_001_001";
     Assert.assertEquals(result, expected);
   }
 
   @Test
   public void checkMsecToString() {
-    long nS = (60L * 60L * 1000L) + (60L * 1000L) + 1000L + 1L;
-    String result = milliSecToString(nS);
-    String expected = "1:01:01.001";
+    final long nS = (60L * 60L * 1000L) + (60L * 1000L) + 1000L + 1L;
+    final String result = milliSecToString(nS);
+    final String expected = "1:01:01.001";
     Assert.assertEquals(result, expected);
   }
 
@@ -302,9 +302,9 @@ public class UtilTest {
 
   @Test
   public void checkPwr2LawExamples() {
-    int maxP = 32;
-    int minP = 1;
-    int ppo = 4;
+    final int maxP = 32;
+    final int minP = 1;
+    final int ppo = 4;
 
     for (int p = minP; p <= maxP; p = pwr2LawNext(ppo, p)) {
       print(p + " ");
@@ -324,7 +324,7 @@ public class UtilTest {
     try {
       simpleIntLog2(0);
       fail();
-    } catch (SketchesArgumentException e) {}
+    } catch (final SketchesArgumentException e) { }
   }
 
   //Resources
@@ -357,7 +357,7 @@ public class UtilTest {
 
   @Test
   public void printlnTest() {
-    println("PRINTING: "+this.getClass().getName());
+    println("PRINTING: " + this.getClass().getName());
   }
 
   static void println(final Object o) {
diff --git a/src/test/java/org/apache/datasketches/cpc/BitMatrix.java b/src/test/java/org/apache/datasketches/cpc/BitMatrix.java
index eca0685..9b5c50b 100644
--- a/src/test/java/org/apache/datasketches/cpc/BitMatrix.java
+++ b/src/test/java/org/apache/datasketches/cpc/BitMatrix.java
@@ -36,11 +36,11 @@ class BitMatrix {
   private long[] bitMatrix;
   private boolean numCouponsInvalid; //only used if we allowed merges
 
-  BitMatrix(int lgK) {
+  BitMatrix(final int lgK) {
     this(lgK, DEFAULT_UPDATE_SEED);
   }
 
-  BitMatrix(int lgK, long seed) {
+  BitMatrix(final int lgK, final long seed) {
     this.lgK = lgK;
     this.seed = seed;
     bitMatrix = new long[1 << lgK];
@@ -82,7 +82,7 @@ class BitMatrix {
     if (col > 63) { col = 63; } // clip so that 0 <= col <= 63
     final long kMask = (1L << lgK) - 1L;
     int row = (int) (hash0 & kMask);
-    int rowCol = (row << 6) | col;
+    final int rowCol = (row << 6) | col;
 
     // Avoid the hash table's "empty" value which is (2^26 -1, 63) (all ones) by changing it
     // to the pair (2^26 - 2, 63), which effectively merges the two cells.
@@ -90,8 +90,8 @@ class BitMatrix {
     // It can't happen at all if lgK (or maxLgK) < 26.
     if (rowCol == -1) { row ^= 1; } //set the LSB of row to 0
 
-    long oldPattern = bitMatrix[row];
-    long newPattern = oldPattern | (1L << col);
+    final long oldPattern = bitMatrix[row];
+    final long newPattern = oldPattern | (1L << col);
     if (newPattern != oldPattern) {
       numCoupons++;
       bitMatrix[row] = newPattern;
diff --git a/src/test/java/org/apache/datasketches/cpc/CompressedStateTest.java b/src/test/java/org/apache/datasketches/cpc/CompressedStateTest.java
index 6b4cb2b..a2fd4d5 100644
--- a/src/test/java/org/apache/datasketches/cpc/CompressedStateTest.java
+++ b/src/test/java/org/apache/datasketches/cpc/CompressedStateTest.java
@@ -24,10 +24,9 @@ import static org.testng.Assert.fail;
 
 import java.io.PrintStream;
 
-import org.testng.annotations.Test;
-
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.WritableMemory;
+import org.testng.annotations.Test;
 
 /**
  * @author Lee Rhodes
@@ -40,7 +39,7 @@ public class CompressedStateTest {
 
 
   @SuppressWarnings("unused")
-  private void updateStateUnion(CpcSketch sk) {
+  private void updateStateUnion(final CpcSketch sk) {
     Format skFmt = sk.getFormat();
     CompressedState state = CompressedState.compress(sk);
     Flavor f = state.getFlavor();
@@ -52,9 +51,9 @@ public class CompressedStateTest {
     printf("%8d %8d %10s %35s\n", vIn, c, f.toString(), fmt.toString());
     CompressedState state2 = CompressedState.importFromMemory(wmem);
 
-    CpcUnion union = new CpcUnion(lgK);
+    final CpcUnion union = new CpcUnion(lgK);
     union.update(sk);
-    CpcSketch sk2 = union.getResult();
+    final CpcSketch sk2 = union.getResult();
     skFmt = sk2.getFormat();
     state = CompressedState.compress(sk2);
     f = state.getFlavor();
@@ -70,8 +69,8 @@ public class CompressedStateTest {
   @Test
   public void checkLoadMemory() {
     printf("%8s %8s %10s %35s\n", "vIn", "c", "Flavor", "Format");
-    CpcSketch sk = new CpcSketch(lgK);
-    int k = 1 << lgK;
+    final CpcSketch sk = new CpcSketch(lgK);
+    final int k = 1 << lgK;
 
     //EMPTY_MERGED
     updateStateUnion(sk);
@@ -96,7 +95,7 @@ public class CompressedStateTest {
 
   @Test
   public void checkToString() {
-    CpcSketch sketch = new CpcSketch(10);
+    final CpcSketch sketch = new CpcSketch(10);
     CompressedState state = CompressedState.compress(sketch);
     println(state.toString());
     sketch.update(0);
@@ -109,27 +108,27 @@ public class CompressedStateTest {
 
   @Test
   public void checkIsCompressed() {
-    CpcSketch sk = new CpcSketch(10);
-    byte[] byteArr = sk.toByteArray();
+    final CpcSketch sk = new CpcSketch(10);
+    final byte[] byteArr = sk.toByteArray();
     byteArr[5] &= (byte) -3;
     try {
       CompressedState.importFromMemory(Memory.wrap(byteArr));
       fail();
-    } catch (AssertionError e) {}
+    } catch (final AssertionError e) { }
   }
 
   /**
    * @param format the string to print
    * @param args the arguments
    */
-  private static void printf(String format, Object... args) {
+  private static void printf(final String format, final Object... args) {
     //ps.printf(format, args);
   }
 
   /**
    * @param s the string to print
    */
-  private static void println(String s) {
+  private static void println(final String s) {
     //ps.println(s);  //disable here
   }
 
diff --git a/src/test/java/org/apache/datasketches/cpc/CompressionCharacterization.java b/src/test/java/org/apache/datasketches/cpc/CompressionCharacterization.java
index 967a1c0..10c8f63 100644
--- a/src/test/java/org/apache/datasketches/cpc/CompressionCharacterization.java
+++ b/src/test/java/org/apache/datasketches/cpc/CompressionCharacterization.java
@@ -63,8 +63,16 @@ public class CompressionCharacterization {
   private CpcSketch[] unCompressedSketches;
 
 
-  public CompressionCharacterization(int lgMinK, int lgMaxK, int lgMinT, int lgMaxT, int lgMulK,
-      int uPPO, int incLgK, PrintStream pS, PrintWriter pW) {
+  public CompressionCharacterization(
+      final int lgMinK,
+      final int lgMaxK,
+      final int lgMinT,
+      final int lgMaxT,
+      final int lgMulK,
+      final int uPPO,
+      final int incLgK,
+      final PrintStream pS,
+      final PrintWriter pW) {
     this.lgMinK = lgMinK;
     this.lgMaxK = lgMaxK;
     this.lgMinT = lgMinT;
@@ -88,27 +96,27 @@ public class CompressionCharacterization {
     }
   }
 
-  private void doRangeOfNAtLgK(int lgK) {
+  private void doRangeOfNAtLgK(final int lgK) {
     long n = 1;
-    int lgMaxN = lgK + lgMulK;
-    long maxN = 1L << lgMaxN;
-    double slope = -(double)(lgMaxT - lgMinT) / lgMaxN;
+    final int lgMaxN = lgK + lgMulK;
+    final long maxN = 1L << lgMaxN;
+    final double slope = -(double)(lgMaxT - lgMinT) / lgMaxN;
 
     while (n <= maxN) {
-      double lgT = (slope * log2(n)) + lgMaxT;
-      int totTrials = Math.max(ceilingPowerOf2((int) Math.pow(2.0, lgT)), (1 << lgMinT));
+      final double lgT = (slope * log2(n)) + lgMaxT;
+      final int totTrials = Math.max(ceilingPowerOf2((int) Math.pow(2.0, lgT)), (1 << lgMinT));
       doTrialsAtLgKAtN(lgK, n, totTrials);
       n = Math.round(pwrLawNextDouble(uPPO, n, true, 2.0));
     }
   }
 
-  private void doTrialsAtLgKAtN(int lgK, long n, int totalTrials) {
-    int k = 1 << lgK;
-    int minNK = (int) ((k < n) ? k : n);
-    double nOverK = (double) n / k;
-    int lgTotTrials = Integer.numberOfTrailingZeros(totalTrials);
-    int lgWaves = Math.max(lgTotTrials - 10, 0);
-    int trialsPerWave = 1 << (lgTotTrials - lgWaves);
+  private void doTrialsAtLgKAtN(final int lgK, final long n, final int totalTrials) {
+    final int k = 1 << lgK;
+    final int minNK = (int) ((k < n) ? k : n);
+    final double nOverK = (double) n / k;
+    final int lgTotTrials = Integer.numberOfTrailingZeros(totalTrials);
+    final int lgWaves = Math.max(lgTotTrials - 10, 0);
+    final int trialsPerWave = 1 << (lgTotTrials - lgWaves);
     //printf("%d %d %d %d\n", totalTrials, lgTotTrials, 1 << lgWaves, trialsPerWave);
     streamSketches = new CpcSketch[trialsPerWave];
     compressedStates1 = new CompressedState[trialsPerWave];
@@ -128,14 +136,14 @@ public class CompressionCharacterization {
     long sumUnc_nS = 0;
     long sumEqu_nS = 0;
     long nanoStart, nanoEnd;
-    long start = System.currentTimeMillis();
+    final long start = System.currentTimeMillis();
     //Wave Loop
     for (int w = 0; w < (1 << lgWaves); w++) {
 
       //Construct array with sketches loop
       nanoStart = System.nanoTime();
       for (int trial = 0; trial < trialsPerWave; trial++) {
-        CpcSketch sketch = new CpcSketch(lgK);
+        final CpcSketch sketch = new CpcSketch(lgK);
         streamSketches[trial] = sketch;
       }
       nanoEnd = System.nanoTime();
@@ -144,7 +152,7 @@ public class CompressionCharacterization {
 
       //Sketch Update loop
       for (int trial = 0; trial < trialsPerWave; trial++) {
-        CpcSketch sketch = streamSketches[trial];
+        final CpcSketch sketch = streamSketches[trial];
         for (long i = 0; i < n; i++) { //increment loop
           sketch.update(vIn += iGoldenU64);
         }
@@ -155,8 +163,8 @@ public class CompressionCharacterization {
 
       //Compress loop
       for (int trial = 0; trial < trialsPerWave; trial++) {
-        CpcSketch sketch = streamSketches[trial];
-        CompressedState state = CompressedState.compress(sketch);
+        final CpcSketch sketch = streamSketches[trial];
+        final CompressedState state = CompressedState.compress(sketch);
         compressedStates1[trial] = state;
         totalC += sketch.numCoupons;
         totalW += state.csvLengthInts + state.cwLengthInts;
@@ -167,9 +175,9 @@ public class CompressionCharacterization {
 
       //State to Memory loop
       for (int trial = 0; trial < trialsPerWave; trial++) {
-        CompressedState state = compressedStates1[trial];
-        long cap = state.getRequiredSerializedBytes();
-        WritableMemory wmem = WritableMemory.allocate((int) cap);
+        final CompressedState state = compressedStates1[trial];
+        final long cap = state.getRequiredSerializedBytes();
+        final WritableMemory wmem = WritableMemory.allocate((int) cap);
         state.exportToMemory(wmem);
         memoryArr[trial] = wmem;
       }
@@ -180,8 +188,8 @@ public class CompressionCharacterization {
 
       //Memory to State loop
       for (int trial = 0; trial < trialsPerWave; trial++) {
-        Memory mem = memoryArr[trial];
-        CompressedState state = importFromMemory(mem);
+        final Memory mem = memoryArr[trial];
+        final CompressedState state = importFromMemory(mem);
         compressedStates2[trial] = state;
       }
 
@@ -191,7 +199,7 @@ public class CompressionCharacterization {
 
       //Uncompress loop
       for (int trial = 0; trial < trialsPerWave; trial++) {
-        CompressedState state = compressedStates2[trial];
+        final CompressedState state = compressedStates2[trial];
         CpcSketch uncSk = null;
         uncSk = CpcSketch.uncompress(state, DEFAULT_UPDATE_SEED);
         unCompressedSketches[trial] = uncSk;
@@ -212,11 +220,11 @@ public class CompressionCharacterization {
 
     } // end wave loop
 
-    double total_S = (System.currentTimeMillis() - start) / 1E3;
-    double avgC = (1.0 * totalC) / totalTrials;
-    double avgCoK = avgC / k;
-    double avgWords = (1.0 * totalW) / totalTrials;
-    double avgBytes = (4.0 * totalW) / totalTrials;
+    final double total_S = (System.currentTimeMillis() - start) / 1E3;
+    final double avgC = (1.0 * totalC) / totalTrials;
+    final double avgCoK = avgC / k;
+    final double avgWords = (1.0 * totalW) / totalTrials;
+    final double avgBytes = (4.0 * totalW) / totalTrials;
 
     final double avgCtor_nS = Math.round((double) sumCtor_nS / totalTrials);
 
@@ -242,10 +250,10 @@ public class CompressionCharacterization {
     final double avgEqu_nSperMinNK = avgEqu_nS / minNK;
 
 
-    int len = unCompressedSketches.length;
-    Flavor finFlavor = unCompressedSketches[len - 1].getFlavor();
-    String offStr = Integer.toString(unCompressedSketches[len - 1].windowOffset);
-    String flavorOff = finFlavor.toString() + String.format("%2s", offStr);
+    final int len = unCompressedSketches.length;
+    final Flavor finFlavor = unCompressedSketches[len - 1].getFlavor();
+    final String offStr = Integer.toString(unCompressedSketches[len - 1].windowOffset);
+    final String flavorOff = finFlavor.toString() + String.format("%2s", offStr);
     printf(dfmt,
         lgK,
         totalTrials,
@@ -273,13 +281,13 @@ public class CompressionCharacterization {
         total_S);
   }
 
-  private void printf(String format, Object ... args) {
+  private void printf(final String format, final Object ... args) {
     if (ps != null) { ps.printf(format, args); }
     if (pw != null) { pw.printf(format, args); }
   }
 
   private void assembleFormats() {
-    String[][] assy = {
+    final String[][] assy = {
         {"lgK",        "%3s",  "%3d"},
         {"Trials",     "%9s",  "%9d"},
         {"n",          "%12s", "%12d"},
@@ -305,13 +313,13 @@ public class CompressionCharacterization {
         {"AvgEqu_nSperMinNK", "%18s", "%18.4g"},
         {"Total_S",           "%8s",  "%8.3f"}
     };
-    int cols = assy.length;
+    final int cols = assy.length;
     hStrArr = new String[cols];
-    StringBuilder headerFmt = new StringBuilder();
-    StringBuilder dataFmt = new StringBuilder();
+    final StringBuilder headerFmt = new StringBuilder();
+    final StringBuilder dataFmt = new StringBuilder();
     headerFmt.append("\nCompression Characterization\n");
     for (int i = 0; i < cols; i++) {
-      hStrArr[i] =assy[i][0];
+      hStrArr[i] = assy[i][0];
       headerFmt.append(assy[i][1]);
       headerFmt.append((i < (cols - 1)) ? "\t" : "\n");
       dataFmt.append(assy[i][2]);
diff --git a/tools/SketchesCheckstyle.xml b/tools/SketchesCheckstyle.xml
index b7659fd..bd5e06b 100644
--- a/tools/SketchesCheckstyle.xml
+++ b/tools/SketchesCheckstyle.xml
@@ -36,7 +36,7 @@ under the License.
 <module name = "Checker">
   <property name="charset" value="UTF-8"/>
   <property name="severity" value="warning"/>
-  <property name="fileExtensions" value="java, properties, xml"/>
+  <property name="fileExtensions" value="java"/>
 
   <module name="FileTabCharacter">
     <property name="eachLine" value="true"/>
@@ -56,6 +56,14 @@ under the License.
     <!-- <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> -->
   </module>
   
+  <module name="SuppressWithPlainTextCommentFilter">
+    <property name="offCommentFormat" value="//CHECKSTYLE.OFF\: ([\w\|]+)"/>
+    <property name="onCommentFormat" value="//CHECKSTYLE.ON\: ([\w\|]+)"/>
+    <property name="checkFormat" value="$1"/>
+  </module>
+  
+  <!-- ******************************************************** -->
+  
   <module name="TreeWalker">
     
     <!-- Annotations -->
@@ -176,8 +184,8 @@ under the License.
     <!-- Enable suppression using comments: //CHECKSTYLE.OFF: "RULE" and //CHECKSTYLE.ON: "RULE"
      You must specify the specific rule, as in: //CHECKSTYLE.OFF: LineLength -->
     <module name="SuppressionCommentFilter">
-      <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
-      <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
+      <property name="offCommentFormat" value="//CHECKSTYLE.OFF\: ([\w\|]+)"/>
+      <property name="onCommentFormat" value="//CHECKSTYLE.ON\: ([\w\|]+)"/>
       <property name="checkFormat" value="$1"/>
     </module>
     


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org