StatUtils { public static double geometricMean(final double[] values) throws MathIllegalArgumentException { return GEOMETRIC_MEAN.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 testGeometricMean() { double[] test = null; try { StatUtils.geometricMean(test); Assert.fail("Expecting MathIllegalArgumentException"); } catch (MathIllegalArgumentException ex) { } test = new double[] {2, 4, 6, 8}; Assert.assertEquals(FastMath.exp(0.25d * StatUtils.sumLog(test)), StatUtils.geometricMean(test), Double.MIN_VALUE); Assert.assertEquals(FastMath.exp(0.5 * StatUtils.sumLog(test, 0, 2)), StatUtils.geometricMean(test, 0, 2), Double.MIN_VALUE); }