MathUtils { public static double findMin(@Nonnull final double[] a) { assert a != null; assert a.length > 0; double min = a[0]; for (final double x : a) { if (min > x) { min = x; } } return min; } private  MathUtils(); static double findMin(@Nonnull final double[] a); static double findMax(@Nonnull final double[] a); static boolean isAlmostZero(final double x); static boolean isAlmostEqual(final double x, final double y); static boolean isBetween(final int value, final int min, final int max); static boolean isBetween(final double value, final double min, final double max); static int limitTo(final int value, final int min, final int max); static double limitTo(final double value, final double min, final double max); static int random(final int min, final int max); static void setRandomSeed(final long seed); static double wrapValueToWithinLimits(
            final double value,
            final int limit); static final double EPSILON; }
@Test public void testFindMin() { LOG.info("testFindMin"); final double[] a1 = {1, 2, 3}; final double[] a2 = {3, 1, 2}; final double[] a3 = {2, 3, 1}; Assert.assertTrue("Min should be 1", Double.compare(MathUtils.findMin(a1), 1.0) == 0); Assert.assertTrue("Min should be 1", Double.compare(MathUtils.findMin(a2), 1.0) == 0); Assert.assertTrue("Min should be 1", Double.compare(MathUtils.findMin(a3), 1.0) == 0); final double[] b1 = {-1, 2, 3}; final double[] b2 = {3, -1, 2}; final double[] b3 = {2, 3, -1}; Assert.assertTrue("Min should be -1", Double.compare(MathUtils.findMin(b1), -1.0) == 0); Assert.assertTrue("Min should be -1", Double.compare(MathUtils.findMin(b2), -1.0) == 0); Assert.assertTrue("Min should be -1", Double.compare(MathUtils.findMin(b3), -1.0) == 0); }