Repository: commons-math
Updated Branches:
  refs/heads/develop 221c843b8 -> 6348d47ca


Use {} for blocks.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/6348d47c
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/6348d47c
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/6348d47c

Branch: refs/heads/develop
Commit: 6348d47ca3f9a64421d092673b35bc834a071e11
Parents: 221c843
Author: Gary Gregory <ggreg...@apache.org>
Authored: Tue Sep 20 10:50:24 2016 -0700
Committer: Gary Gregory <ggreg...@apache.org>
Committed: Tue Sep 20 10:50:24 2016 -0700

----------------------------------------------------------------------
 .../solvers/BaseSecantSolverAbstractTest.java   |  4 +-
 .../apache/commons/math4/dfp/DfpDecTest.java    |  3 +-
 .../apache/commons/math4/dfp/DfpMathTest.java   |  3 +-
 .../org/apache/commons/math4/dfp/DfpTest.java   | 69 +++++++++++++-------
 .../IntegerDistributionAbstractTest.java        |  3 +-
 .../math4/genetics/BinaryMutationTest.java      |  3 +-
 .../genetics/GeneticAlgorithmTestBinary.java    |  3 +-
 .../apache/commons/math4/ode/TestProblem1.java  |  5 +-
 .../apache/commons/math4/ode/TestProblem2.java  |  5 +-
 .../scalar/noderiv/BOBYQAOptimizerTest.java     | 57 ++++++++++------
 .../scalar/noderiv/CMAESOptimizerTest.java      | 57 ++++++++++------
 ...torelessUnivariateStatisticAbstractTest.java |  3 +-
 .../inference/KolmogorovSmirnovTestTest.java    |  3 +-
 .../apache/commons/math4/util/FastMathTest.java |  5 +-
 .../math4/util/OpenIntToDoubleHashMapTest.java  | 18 +++--
 .../commons/math4/util/OpenIntToFieldTest.java  | 18 +++--
 16 files changed, 172 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java
 
b/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java
index 1b6f278..9d16686 100644
--- 
a/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java
+++ 
b/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java
@@ -105,7 +105,9 @@ public abstract class BaseSecantSolverAbstractTest {
 
         for(int i = 0; i < testsData.length; i++) {
             // Skip test, if needed.
-            if (counts[i] == -1) continue;
+            if (counts[i] == -1) {
+                continue;
+            }
 
             // Compute solution.
             double[] testData = testsData[i];

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java 
b/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java
index 0d4a963..a454490 100644
--- a/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java
+++ b/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java
@@ -61,8 +61,9 @@ public class DfpDecTest {
 
         b = (b && x.getField().getIEEEFlags() == flags);
 
-        if (!b)
+        if (!b) {
             Assert.assertTrue("assersion failed "+desc+" x = "+x.toString()+" 
flags = "+x.getField().getIEEEFlags(), b);
+        }
 
         x.getField().clearIEEEFlags();
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java 
b/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java
index a2a14ee..b089acd 100644
--- a/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java
+++ b/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java
@@ -71,8 +71,9 @@ public class DfpMathTest {
 
         b = (b && x.getField().getIEEEFlags() == flags);
 
-        if (!b)
+        if (!b) {
             Assert.assertTrue("assersion failed "+desc+" x = "+x.toString()+" 
flags = "+x.getField().getIEEEFlags(), b);
+        }
 
         x.getField().clearIEEEFlags();
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/dfp/DfpTest.java 
b/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
index c9b375a..eeeae4b 100644
--- a/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
+++ b/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
@@ -375,21 +375,29 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
     // utility function to help test comparisons
     private void cmptst(Dfp a, Dfp b, String op, boolean result, double num)
     {
-        if (op == "equal")
-            if (a.equals(b) != result)
+        if (op == "equal") {
+            if (a.equals(b) != result) {
                 Assert.fail("assersion failed.  "+op+" compare #"+num);
+            }
+        }
 
-        if (op == "unequal")
-            if (a.unequal(b) != result)
+        if (op == "unequal") {
+            if (a.unequal(b) != result) {
                 Assert.fail("assersion failed.  "+op+" compare #"+num);
+            }
+        }
 
-        if (op == "lessThan")
-            if (a.lessThan(b) != result)
+        if (op == "lessThan") {
+            if (a.lessThan(b) != result) {
                 Assert.fail("assersion failed.  "+op+" compare #"+num);
+            }
+        }
 
-        if (op == "greaterThan")
-            if (a.greaterThan(b) != result)
+        if (op == "greaterThan") {
+            if (a.greaterThan(b) != result) {
                 Assert.fail("assersion failed.  "+op+" compare #"+num);
+            }
+        }
     }
 
     @Test
@@ -412,14 +420,16 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         cmptst(field.newDfp("0"), field.newDfp("-1"), "equal", false, 8);      
  // 0 == -1
         cmptst(field.newDfp("0"), field.newDfp("1e-131072"), "equal", false, 
9); // 0 == 1e-131072
         // check flags
-        if (field.getIEEEFlags() != 0)
+        if (field.getIEEEFlags() != 0) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         cmptst(field.newDfp("0"), field.newDfp("1e-131078"), "equal", false, 
10); // 0 == 1e-131078
 
         // check flags  -- underflow should be set
-        if (field.getIEEEFlags() != DfpField.FLAG_UNDERFLOW)
+        if (field.getIEEEFlags() != DfpField.FLAG_UNDERFLOW) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         field.clearIEEEFlags();
 
@@ -449,8 +459,9 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         // The tests below checks to ensure that comparisons don't set 
FLAG_INEXACT
         // 100000 == 1.0000000000000001
         cmptst(field.newDfp("1e20"), field.newDfp("1.0000000000000001"), 
"equal", false, 24);
-        if (field.getIEEEFlags() != 0)
+        if (field.getIEEEFlags() != 0) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         cmptst(field.newDfp("0.000001"), field.newDfp("1e-6"), "equal", true, 
25);
 
@@ -500,14 +511,16 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         cmptst(field.newDfp("0"), field.newDfp("-1"), "unequal", true, 8);     
   // 0 == -1
         cmptst(field.newDfp("0"), field.newDfp("1e-131072"), "unequal", true, 
9); // 0 == 1e-131072
         // check flags
-        if (field.getIEEEFlags() != 0)
+        if (field.getIEEEFlags() != 0) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         cmptst(field.newDfp("0"), field.newDfp("1e-131078"), "unequal", true, 
10); // 0 == 1e-131078
 
         // check flags  -- underflow should be set
-        if (field.getIEEEFlags() != DfpField.FLAG_UNDERFLOW)
+        if (field.getIEEEFlags() != DfpField.FLAG_UNDERFLOW) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         field.clearIEEEFlags();
 
@@ -537,8 +550,9 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         // The tests below checks to ensure that comparisons don't set 
FLAG_INEXACT
         // 100000 == 1.0000000000000001
         cmptst(field.newDfp("1e20"), field.newDfp("1.0000000000000001"), 
"unequal", true, 24);
-        if (field.getIEEEFlags() != 0)
+        if (field.getIEEEFlags() != 0) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         cmptst(field.newDfp("0.000001"), field.newDfp("1e-6"), "unequal", 
false, 25);
 
@@ -571,8 +585,9 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         cmptst(snan.negate(), snan, "unequal", false, 51);
         cmptst(qnan.negate(), qnan, "unequal", false, 52);
 
-        if (field.getIEEEFlags() != 0)
+        if (field.getIEEEFlags() != 0) {
             Assert.fail("assersion failed.  compare unequal flags = 
"+field.getIEEEFlags());
+        }
 
         //
         // Tests for lessThan  -- do it all over again
@@ -591,14 +606,16 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         cmptst(field.newDfp("0"), field.newDfp("-1"), "lessThan", false, 8);   
     // 0 < -1
         cmptst(field.newDfp("0"), field.newDfp("1e-131072"), "lessThan", true, 
9); // 0 < 1e-131072
         // check flags
-        if (field.getIEEEFlags() != 0)
+        if (field.getIEEEFlags() != 0) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         cmptst(field.newDfp("0"), field.newDfp("1e-131078"), "lessThan", true, 
10); // 0 < 1e-131078
 
         // check flags  -- underflow should be set
-        if (field.getIEEEFlags() != DfpField.FLAG_UNDERFLOW)
+        if (field.getIEEEFlags() != DfpField.FLAG_UNDERFLOW) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
         field.clearIEEEFlags();
 
         cmptst(field.newDfp("0"), field.newDfp("1e+131071"), "lessThan", true, 
11); // 0 < 1e+131071
@@ -627,8 +644,9 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         // The tests below checks to ensure that comparisons don't set 
FLAG_INEXACT
         // 100000 < 1.0000000000000001
         cmptst(field.newDfp("1e20"), field.newDfp("1.0000000000000001"), 
"lessThan", false, 24);
-        if (field.getIEEEFlags() != 0)
+        if (field.getIEEEFlags() != 0) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         cmptst(field.newDfp("0.000001"), field.newDfp("1e-6"), "lessThan", 
false, 25);
 
@@ -661,8 +679,9 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         cmptst(qnan.negate(), qnan, "lessThan", false, 52);
 
         //lessThan compares with nans should raise FLAG_INVALID
-        if (field.getIEEEFlags() != DfpField.FLAG_INVALID)
+        if (field.getIEEEFlags() != DfpField.FLAG_INVALID) {
             Assert.fail("assersion failed.  compare lessThan flags = 
"+field.getIEEEFlags());
+        }
         field.clearIEEEFlags();
 
         //
@@ -682,14 +701,16 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         cmptst(field.newDfp("0"), field.newDfp("-1"), "greaterThan", true, 8); 
       // 0 > -1
         cmptst(field.newDfp("0"), field.newDfp("1e-131072"), "greaterThan", 
false, 9); // 0 > 1e-131072
         // check flags
-        if (field.getIEEEFlags() != 0)
+        if (field.getIEEEFlags() != 0) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         cmptst(field.newDfp("0"), field.newDfp("1e-131078"), "greaterThan", 
false, 10); // 0 > 1e-131078
 
         // check flags  -- underflow should be set
-        if (field.getIEEEFlags() != DfpField.FLAG_UNDERFLOW)
+        if (field.getIEEEFlags() != DfpField.FLAG_UNDERFLOW) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
         field.clearIEEEFlags();
 
         cmptst(field.newDfp("0"), field.newDfp("1e+131071"), "greaterThan", 
false, 11); // 0 > 1e+131071
@@ -718,8 +739,9 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         // The tests below checks to ensure that comparisons don't set 
FLAG_INEXACT
         // 100000 > 1.0000000000000001
         cmptst(field.newDfp("1e20"), field.newDfp("1.0000000000000001"), 
"greaterThan", true, 24);
-        if (field.getIEEEFlags() != 0)
+        if (field.getIEEEFlags() != 0) {
             Assert.fail("assersion failed.  compare flags = 
"+field.getIEEEFlags());
+        }
 
         cmptst(field.newDfp("0.000001"), field.newDfp("1e-6"), "greaterThan", 
false, 25);
 
@@ -752,8 +774,9 @@ public class DfpTest extends 
ExtendedFieldElementAbstractTest<Dfp> {
         cmptst(qnan.negate(), qnan, "greaterThan", false, 52);
 
         //greaterThan compares with nans should raise FLAG_INVALID
-        if (field.getIEEEFlags() != DfpField.FLAG_INVALID)
+        if (field.getIEEEFlags() != DfpField.FLAG_INVALID) {
             Assert.fail("assersion failed.  compare greaterThan flags = 
"+field.getIEEEFlags());
+        }
         field.clearIEEEFlags();
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
 
b/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
index 43e930e..34cceb7 100644
--- 
a/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
+++ 
b/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
@@ -250,9 +250,10 @@ public abstract class IntegerDistributionAbstractTest {
                 lower, distribution.inverseCumulativeProbability(0.0));
 
         final int upper = distribution.getSupportUpperBound();
-        if (upper != Integer.MAX_VALUE)
+        if (upper != Integer.MAX_VALUE) {
             Assert.assertEquals("Cumulative probability of support upper bound 
must be equal to 1.",
                     1.0, distribution.cumulativeProbability(upper), 0.0);
+        }
         Assert.assertEquals("Inverse cumulative probability of 1 must be equal 
to support upper bound.",
                 upper, distribution.inverseCumulativeProbability(1.0));
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java 
b/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java
index 5ada12a..44e5bdb 100644
--- a/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java
@@ -36,8 +36,9 @@ public class BinaryMutationTest {
             // one gene should be different
             int numDifferent = 0;
             for (int j=0; j<original.getRepresentation().size(); j++) {
-                if (original.getRepresentation().get(j) != 
mutated.getRepresentation().get(j))
+                if (original.getRepresentation().get(j) != 
mutated.getRepresentation().get(j)) {
                     numDifferent++;
+                }
             }
             Assert.assertEquals(1, numDifferent);
         }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java
 
b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java
index 71a1258..e791c98 100644
--- 
a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java
+++ 
b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java
@@ -119,8 +119,9 @@ public class GeneticAlgorithmTestBinary {
         public double fitness() {
             int num = 0;
             for (int val : this.getRepresentation()) {
-                if (val != 0)
+                if (val != 0) {
                     num++;
+                }
             }
             // number of elements >= 0
             return num;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/ode/TestProblem1.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem1.java 
b/src/test/java/org/apache/commons/math4/ode/TestProblem1.java
index 62ad222..815551a 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblem1.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblem1.java
@@ -56,8 +56,9 @@ public class TestProblem1
   public void doComputeDerivatives(double t, double[] y, double[] yDot) {
 
     // compute the derivatives
-    for (int i = 0; i < getDimension(); ++i)
-      yDot[i] = -y[i];
+    for (int i = 0; i < getDimension(); ++i) {
+        yDot[i] = -y[i];
+    }
 
   }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/ode/TestProblem2.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem2.java 
b/src/test/java/org/apache/commons/math4/ode/TestProblem2.java
index 4936a02..062e3dd 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblem2.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblem2.java
@@ -57,8 +57,9 @@ public class TestProblem2
   public void doComputeDerivatives(double t, double[] y, double[] yDot) {
 
     // compute the derivatives
-    for (int i = 0; i < getDimension(); ++i)
-      yDot[i] = t * (t * t - y[i]);
+    for (int i = 0; i < getDimension(); ++i) {
+        yDot[i] = t * (t * t - y[i]);
+    }
 
   }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
 
b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
index 55d43a0..a51a222 100644
--- 
a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
+++ 
b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
@@ -356,10 +356,12 @@ public class BOBYQAOptimizerTest {
     private static double[][] boundaries(int dim,
             double lower, double upper) {
         double[][] boundaries = new double[2][dim];
-        for (int i = 0; i < dim; i++)
+        for (int i = 0; i < dim; i++) {
             boundaries[0][i] = lower;
-        for (int i = 0; i < dim; i++)
+        }
+        for (int i = 0; i < dim; i++) {
             boundaries[1][i] = upper;
+        }
         return boundaries;
     }
 
@@ -368,8 +370,9 @@ public class BOBYQAOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += x[i] * x[i];
+            }
             return f;
         }
     }
@@ -388,8 +391,9 @@ public class BOBYQAOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = x[0] * x[0];
-            for (int i = 1; i < x.length; ++i)
+            for (int i = 1; i < x.length; ++i) {
                 f += factor * x[i] * x[i];
+            }
             return f;
         }
     }
@@ -408,8 +412,9 @@ public class BOBYQAOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = factor * x[0] * x[0];
-            for (int i = 1; i < x.length; ++i)
+            for (int i = 1; i < x.length; ++i) {
                 f += x[i] * x[i];
+            }
             return f;
         }
     }
@@ -429,8 +434,9 @@ public class BOBYQAOptimizerTest {
         public double value(double[] x) {
             int end = x.length - 1;
             double f = x[0] * x[0] / factor + factor * x[end] * x[end];
-            for (int i = 1; i < end; ++i)
+            for (int i = 1; i < end; ++i) {
                 f += x[i] * x[i];
+            }
             return f;
         }
     }
@@ -450,8 +456,9 @@ public class BOBYQAOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += (i < x.length / 2 ? factor : 1) * x[i] * x[i];
+            }
             return f;
         }
     }
@@ -472,8 +479,9 @@ public class BOBYQAOptimizerTest {
         public double value(double[] x) {
             double f = 0;
             x = B.Rotate(x);
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += FastMath.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
+            }
             return f;
         }
     }
@@ -493,8 +501,9 @@ public class BOBYQAOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += FastMath.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
+            }
             return f;
         }
     }
@@ -512,9 +521,10 @@ public class BOBYQAOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += FastMath.pow(FastMath.abs(x[i]), 2. + 10 * (double) i
                         / (x.length - 1.));
+            }
 //            System.out.print("" + (fcount++) + ") ");
 //            for (int i = 0; i < x.length; i++)
 //                System.out.print(x[i] +  " ");
@@ -537,9 +547,10 @@ public class BOBYQAOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length - 1; ++i)
+            for (int i = 0; i < x.length - 1; ++i) {
                 f += 1e2 * (x[i] * x[i] - x[i + 1]) * (x[i] * x[i] - x[i + 1])
                 + (x[i] - 1.) * (x[i] - 1.);
+            }
             return f;
         }
     }
@@ -591,8 +602,9 @@ public class BOBYQAOptimizerTest {
             double fac;
             for (int i = 0; i < x.length; ++i) {
                 fac = FastMath.pow(axisratio, (i - 1.) / (x.length - 1.));
-                if (i == 0 && x[i] < 0)
+                if (i == 0 && x[i] < 0) {
                     fac *= 1.;
+                }
                 f += fac * fac * x[i] * x[i] + amplitude
                 * (1. - FastMath.cos(2. * FastMath.PI * fac * x[i]));
             }
@@ -609,15 +621,17 @@ public class BOBYQAOptimizerTest {
             double[] y = new double[x.length];
             for (int i = 0; i < x.length; ++i) {
                 y[i] = 0;
-                for (int j = 0; j < x.length; ++j)
+                for (int j = 0; j < x.length; ++j) {
                     y[i] += basis[i][j] * x[j];
+                }
             }
             return y;
         }
 
         void GenBasis(int DIM) {
-            if (basis != null ? basis.length == DIM : false)
+            if (basis != null ? basis.length == DIM : false) {
                 return;
+            }
 
             double sp;
             int i, j, k;
@@ -626,20 +640,25 @@ public class BOBYQAOptimizerTest {
             basis = new double[DIM][DIM];
             for (i = 0; i < DIM; ++i) {
                 /* sample components gaussian */
-                for (j = 0; j < DIM; ++j)
+                for (j = 0; j < DIM; ++j) {
                     basis[i][j] = rand.nextGaussian();
+                }
                 /* substract projection of previous vectors */
                 for (j = i - 1; j >= 0; --j) {
-                    for (sp = 0., k = 0; k < DIM; ++k)
+                    for (sp = 0., k = 0; k < DIM; ++k) {
                         sp += basis[i][k] * basis[j][k]; /* scalar product */
-                    for (k = 0; k < DIM; ++k)
+                    }
+                    for (k = 0; k < DIM; ++k) {
                         basis[i][k] -= sp * basis[j][k]; /* substract */
+                    }
                 }
                 /* normalize */
-                for (sp = 0., k = 0; k < DIM; ++k)
+                for (sp = 0., k = 0; k < DIM; ++k) {
                     sp += basis[i][k] * basis[i][k]; /* squared norm */
-                for (k = 0; k < DIM; ++k)
+                }
+                for (k = 0; k < DIM; ++k) {
                     basis[i][k] /= FastMath.sqrt(sp);
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
 
b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
index c722798..6b23894 100644
--- 
a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
+++ 
b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
@@ -524,10 +524,12 @@ public class CMAESOptimizerTest {
     private static double[][] boundaries(int dim,
             double lower, double upper) {
         double[][] boundaries = new double[2][dim];
-        for (int i = 0; i < dim; i++)
+        for (int i = 0; i < dim; i++) {
             boundaries[0][i] = lower;
-        for (int i = 0; i < dim; i++)
+        }
+        for (int i = 0; i < dim; i++) {
             boundaries[1][i] = upper;
+        }
         return boundaries;
     }
 
@@ -536,8 +538,9 @@ public class CMAESOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += x[i] * x[i];
+            }
             return f;
         }
     }
@@ -556,8 +559,9 @@ public class CMAESOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = x[0] * x[0];
-            for (int i = 1; i < x.length; ++i)
+            for (int i = 1; i < x.length; ++i) {
                 f += factor * x[i] * x[i];
+            }
             return f;
         }
     }
@@ -576,8 +580,9 @@ public class CMAESOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = factor * x[0] * x[0];
-            for (int i = 1; i < x.length; ++i)
+            for (int i = 1; i < x.length; ++i) {
                 f += x[i] * x[i];
+            }
             return f;
         }
     }
@@ -597,8 +602,9 @@ public class CMAESOptimizerTest {
         public double value(double[] x) {
             int end = x.length - 1;
             double f = x[0] * x[0] / factor + factor * x[end] * x[end];
-            for (int i = 1; i < end; ++i)
+            for (int i = 1; i < end; ++i) {
                 f += x[i] * x[i];
+            }
             return f;
         }
     }
@@ -618,8 +624,9 @@ public class CMAESOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += (i < x.length / 2 ? factor : 1) * x[i] * x[i];
+            }
             return f;
         }
     }
@@ -640,8 +647,9 @@ public class CMAESOptimizerTest {
         public double value(double[] x) {
             double f = 0;
             x = B.Rotate(x);
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += FastMath.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
+            }
             return f;
         }
     }
@@ -661,8 +669,9 @@ public class CMAESOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += FastMath.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
+            }
             return f;
         }
     }
@@ -680,9 +689,10 @@ public class CMAESOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length; ++i)
+            for (int i = 0; i < x.length; ++i) {
                 f += FastMath.pow(FastMath.abs(x[i]), 2. + 10 * (double) i
                         / (x.length - 1.));
+            }
             return f;
         }
     }
@@ -701,9 +711,10 @@ public class CMAESOptimizerTest {
         @Override
         public double value(double[] x) {
             double f = 0;
-            for (int i = 0; i < x.length - 1; ++i)
+            for (int i = 0; i < x.length - 1; ++i) {
                 f += 1e2 * (x[i] * x[i] - x[i + 1]) * (x[i] * x[i] - x[i + 1])
                 + (x[i] - 1.) * (x[i] - 1.);
+            }
             return f;
         }
     }
@@ -755,8 +766,9 @@ public class CMAESOptimizerTest {
             double fac;
             for (int i = 0; i < x.length; ++i) {
                 fac = FastMath.pow(axisratio, (i - 1.) / (x.length - 1.));
-                if (i == 0 && x[i] < 0)
+                if (i == 0 && x[i] < 0) {
                     fac *= 1.;
+                }
                 f += fac * fac * x[i] * x[i] + amplitude
                 * (1. - FastMath.cos(2. * FastMath.PI * fac * x[i]));
             }
@@ -773,15 +785,17 @@ public class CMAESOptimizerTest {
             double[] y = new double[x.length];
             for (int i = 0; i < x.length; ++i) {
                 y[i] = 0;
-                for (int j = 0; j < x.length; ++j)
+                for (int j = 0; j < x.length; ++j) {
                     y[i] += basis[i][j] * x[j];
+                }
             }
             return y;
         }
 
         void GenBasis(int DIM) {
-            if (basis != null ? basis.length == DIM : false)
+            if (basis != null ? basis.length == DIM : false) {
                 return;
+            }
 
             double sp;
             int i, j, k;
@@ -790,20 +804,25 @@ public class CMAESOptimizerTest {
             basis = new double[DIM][DIM];
             for (i = 0; i < DIM; ++i) {
                 /* sample components gaussian */
-                for (j = 0; j < DIM; ++j)
+                for (j = 0; j < DIM; ++j) {
                     basis[i][j] = rand.nextGaussian();
+                }
                 /* substract projection of previous vectors */
                 for (j = i - 1; j >= 0; --j) {
-                    for (sp = 0., k = 0; k < DIM; ++k)
+                    for (sp = 0., k = 0; k < DIM; ++k) {
                         sp += basis[i][k] * basis[j][k]; /* scalar product */
-                    for (k = 0; k < DIM; ++k)
+                    }
+                    for (k = 0; k < DIM; ++k) {
                         basis[i][k] -= sp * basis[j][k]; /* substract */
+                    }
                 }
                 /* normalize */
-                for (sp = 0., k = 0; k < DIM; ++k)
+                for (sp = 0., k = 0; k < DIM; ++k) {
                     sp += basis[i][k] * basis[i][k]; /* squared norm */
-                for (k = 0; k < DIM; ++k)
+                }
+                for (k = 0; k < DIM; ++k) {
                     basis[i][k] /= FastMath.sqrt(sp);
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
 
b/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
index bcbceae..c942faf 100644
--- 
a/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
+++ 
b/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
@@ -89,8 +89,9 @@ public abstract class StorelessUnivariateStatisticAbstractTest
 
         for (int i = 0; i < testArray.length; i++) {
             statistic.increment(testArray[i]);
-            if(i % 5 == 0)
+            if(i % 5 == 0) {
                 statistic = 
(StorelessUnivariateStatistic)TestUtils.serializeAndRecover(statistic);
+            }
         }
 
         TestUtils.checkSerializedEquality(statistic);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
 
b/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
index 32aa642..0c683c2 100644
--- 
a/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
+++ 
b/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
@@ -655,9 +655,10 @@ public class KolmogorovSmirnovTestTest {
         for (int i = 0; i < combined.length; i++) {
             for (int j = 0; j < i; j++) {
                 Assert.assertTrue(combined[i] != combined[j]);
-                if (combined[i] < combined[j])
+                if (combined[i] < combined[j]) {
                     Assert.assertTrue(origCombined[i] < origCombined[j]
                                           || origCombined[i] == 
origCombined[j]);
+                }
             }
 
         }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/util/FastMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/FastMathTest.java 
b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
index 6314789..2df8925 100644
--- a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
+++ b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
@@ -836,10 +836,11 @@ public class FastMathTest {
             Dfp refdfp = DfpMath.atan(field.newDfp(y).divide(field.newDfp(x)));
             /* Make adjustments for sign */
             if (x < 0.0) {
-                if (y > 0.0)
+                if (y > 0.0) {
                     refdfp = field.getPi().add(refdfp);
-                else
+                } else {
                     refdfp = refdfp.subtract(field.getPi());
+                }
             }
 
             double ref = refdfp.toDouble();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java 
b/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
index eea8560..5da2f71 100644
--- 
a/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
+++ 
b/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
@@ -62,8 +62,9 @@ public class OpenIntToDoubleHashMapTest {
     private Map<Integer, Double> generate() {
         Map<Integer, Double> map = new HashMap<>();
         Random r = new Random();
-        for (int i = 0; i < 2000; ++i)
+        for (int i = 0; i < 2000; ++i) {
             map.put(r.nextInt(), r.nextDouble());
+        }
         return map;
     }
 
@@ -102,8 +103,9 @@ public class OpenIntToDoubleHashMapTest {
         Assert.assertEquals(mapSize, map.size());
         for (Map.Entry<Integer, Double> mapEntry : javaMap.entrySet()) {
             map.put(mapEntry.getKey(), mapEntry.getValue());
-            if (!keysInMap.contains(mapEntry.getKey()))
+            if (!keysInMap.contains(mapEntry.getKey())) {
                 ++mapSize;
+            }
             Assert.assertEquals(mapSize, map.size());
             Assert.assertTrue(Precision.equals(mapEntry.getValue(), 
map.get(mapEntry.getKey()), 1));
         }
@@ -135,8 +137,9 @@ public class OpenIntToDoubleHashMapTest {
         Map<Integer, Double> generated = generateAbsent();
         OpenIntToDoubleHashMap map = createFromJavaMap();
 
-        for (Map.Entry<Integer, Double> mapEntry : generated.entrySet())
+        for (Map.Entry<Integer, Double> mapEntry : generated.entrySet()) {
             Assert.assertTrue(Double.isNaN(map.get(mapEntry.getKey())));
+        }
     }
 
     @Test
@@ -174,8 +177,9 @@ public class OpenIntToDoubleHashMapTest {
             map.remove(mapEntry.getKey());
             Assert.assertEquals(--mapSize, map.size());
             Assert.assertTrue(Double.isNaN(map.get(mapEntry.getKey())));
-            if (count++ > 5)
+            if (count++ > 5) {
                 break;
+            }
         }
 
         /* Ensure that put and get still work correctly after removals */
@@ -209,8 +213,9 @@ public class OpenIntToDoubleHashMapTest {
         Map<Integer, Double> generated = new HashMap<>();
         do {
             generated.putAll(generate());
-            for (Integer key : javaMap.keySet())
+            for (Integer key : javaMap.keySet()) {
                 generated.remove(key);
+            }
         } while (generated.size() < 100);
         return generated;
     }
@@ -221,8 +226,9 @@ public class OpenIntToDoubleHashMapTest {
             new OpenIntToDoubleHashMap(createFromJavaMap());
         Assert.assertEquals(javaMap.size(), copy.size());
 
-        for (Map.Entry<Integer, Double> mapEntry : javaMap.entrySet())
+        for (Map.Entry<Integer, Double> mapEntry : javaMap.entrySet()) {
             Assert.assertTrue(Precision.equals(mapEntry.getValue(), 
copy.get(mapEntry.getKey()), 1));
+        }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6348d47c/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java 
b/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java
index d7de53c..1be299b 100644
--- a/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java
+++ b/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java
@@ -65,8 +65,9 @@ public class OpenIntToFieldTest {
         Map<Integer, Fraction> map = new HashMap<>();
         Random r = new Random();
         double dd=0;
-        for (int i = 0; i < 2000; ++i)
+        for (int i = 0; i < 2000; ++i) {
             dd = r.nextDouble();
+        }
             try {
                 map.put(r.nextInt(), new Fraction(dd));
             } catch (FractionConversionException e) {
@@ -110,8 +111,9 @@ public class OpenIntToFieldTest {
         Assert.assertEquals(mapSize, map.size());
         for (Map.Entry<Integer, Fraction> mapEntry : javaMap.entrySet()) {
             map.put(mapEntry.getKey(), mapEntry.getValue());
-            if (!keysInMap.contains(mapEntry.getKey()))
+            if (!keysInMap.contains(mapEntry.getKey())) {
                 ++mapSize;
+            }
             Assert.assertEquals(mapSize, map.size());
             Assert.assertEquals(mapEntry.getValue(), 
map.get(mapEntry.getKey()));
         }
@@ -143,8 +145,9 @@ public class OpenIntToFieldTest {
         Map<Integer, Fraction> generated = generateAbsent();
         OpenIntToFieldHashMap<Fraction> map = createFromJavaMap(field);
 
-        for (Map.Entry<Integer, Fraction> mapEntry : generated.entrySet())
+        for (Map.Entry<Integer, Fraction> mapEntry : generated.entrySet()) {
             
Assert.assertTrue(field.getZero().equals(map.get(mapEntry.getKey())));
+        }
     }
 
     @Test
@@ -182,8 +185,9 @@ public class OpenIntToFieldTest {
             map.remove(mapEntry.getKey());
             Assert.assertEquals(--mapSize, map.size());
             
Assert.assertTrue(field.getZero().equals(map.get(mapEntry.getKey())));
-            if (count++ > 5)
+            if (count++ > 5) {
                 break;
+            }
         }
 
         /* Ensure that put and get still work correctly after removals */
@@ -217,8 +221,9 @@ public class OpenIntToFieldTest {
         Map<Integer, Fraction> generated = new HashMap<>();
         do {
             generated.putAll(generate());
-            for (Integer key : javaMap.keySet())
+            for (Integer key : javaMap.keySet()) {
                 generated.remove(key);
+            }
         } while (generated.size() < 100);
         return generated;
     }
@@ -229,8 +234,9 @@ public class OpenIntToFieldTest {
             new OpenIntToFieldHashMap<>(createFromJavaMap(field));
         Assert.assertEquals(javaMap.size(), copy.size());
 
-        for (Map.Entry<Integer, Fraction> mapEntry : javaMap.entrySet())
+        for (Map.Entry<Integer, Fraction> mapEntry : javaMap.entrySet()) {
             Assert.assertEquals(mapEntry.getValue(), 
copy.get(mapEntry.getKey()));
+        }
     }
 
     @Test

Reply via email to