VariableHelper { static double[] getDoubleVector(int length, double fillValue) { final double[] vector = new double[length]; if (fillValue != 0.0) { Arrays.fill(vector, fillValue); } return vector; }    }
@Test public void testGetFilledVector_doubles_filled() { final double[] doubleVector = VariableHelper.getDoubleVector(18, 0.9986); assertEquals(18, doubleVector.length); for (final double value : doubleVector) { assertEquals(0.9986, value, 1e-8); } }
@Test public void testGetFilledVector_doubles_unfilled() { final double[] doubleVector = VariableHelper.getDoubleVector(17, 0.0); assertEquals(17, doubleVector.length); for (final double value : doubleVector) { assertEquals(0.0, value, 1e-8); } }