StatUtils { public static double sum(final double[] values) throws MathIllegalArgumentException { return SUM.evaluate(values); } private  StatUtils(); static double sum(final double[] values); static double sum(final double[] values, final int begin,
            final int length); static double sumSq(final double[] values); static double sumSq(final double[] values, final int begin,
            final int length); static double product(final double[] values); static double product(final double[] values, final int begin,
            final int length); static double sumLog(final double[] values); static double sumLog(final double[] values, final int begin,
            final int length); static double mean(final double[] values); static double mean(final double[] values, final int begin,
            final int length); static double geometricMean(final double[] values); static double geometricMean(final double[] values, final int begin,
            final int length); static double variance(final double[] values); static double variance(final double[] values, final int begin,
            final int length); static double variance(final double[] values, final double mean,
            final int begin, final int length); static double variance(final double[] values, final double mean); static double populationVariance(final double[] values); static double populationVariance(final double[] values, final int begin,
            final int length); static double populationVariance(final double[] values, final double mean,
            final int begin, final int length); static double populationVariance(final double[] values, final double mean); static double max(final double[] values); static double max(final double[] values, final int begin,
            final int length); static double min(final double[] values); static double min(final double[] values, final int begin,
            final int length); static double percentile(final double[] values, final double p); static double percentile(final double[] values, final int begin,
            final int length, final double p); static double sumDifference(final double[] sample1, final double[] sample2); static double meanDifference(final double[] sample1, final double[] sample2); static double varianceDifference(final double[] sample1,
            final double[] sample2, double meanDifference); static double[] normalize(final double[] sample); static double[] mode(double[] sample); static double[] mode(double[] sample, final int begin, final int length);  }
@Test public void testArrayIndexConditions() { double[] values = { 1.0, 2.0, 3.0, 4.0 }; Assert.assertEquals( "Sum not expected", 5.0, StatUtils.sum(values, 1, 2), Double.MIN_VALUE); Assert.assertEquals( "Sum not expected", 3.0, StatUtils.sum(values, 0, 2), Double.MIN_VALUE); Assert.assertEquals( "Sum not expected", 7.0, StatUtils.sum(values, 2, 2), Double.MIN_VALUE); try { StatUtils.sum(values, 2, 3); Assert.fail("Expected RuntimeException"); } catch (RuntimeException e) { } try { StatUtils.sum(values, -1, 2); Assert.fail("Expected RuntimeException"); } catch (RuntimeException e) { } }