MathTools { static double min(double[] values) { double min = values[0]; for (double value : values) if (value < min) min = value; return min; }    }
@Test public void testMin_arraydouble() { double[] doubles = {2.0, 1.0, 3.0, 5.0, 4.0}; Assert.assertEquals(1.0, MathTools.min(doubles), 0.001); }
@Test public void testMin_arrayint() { int[] ints = {1, 2, 3, 4, 5}; Assert.assertEquals(1, MathTools.min(ints)); }