VariableHelper { static float[] getFloatVector(int length, float fillValue) { final float[] vector = new float[length]; if (fillValue != 0.f) { Arrays.fill(vector, fillValue); } return vector; }    }
@Test public void testGetFilledVector_floats_filled() { final float[] floatVector = VariableHelper.getFloatVector(45, 13.7f); assertEquals(45, floatVector.length); for (final float value : floatVector) { assertEquals(13.7f, value, 1e-8); } }
@Test public void testGetFilledVector_floats_unfilled() { final float[] floatVector = VariableHelper.getFloatVector(26, 0.f); assertEquals(26, floatVector.length); for (final float value : floatVector) { assertEquals(0.f, value, 1e-8); } }