DescriptiveStatistics implements StatisticalSummary, Serializable { @Override public String toString() { StringBuilder outBuffer = new StringBuilder(); String endl = "\n"; outBuffer.append("DescriptiveStatistics:").append(endl); outBuffer.append("n: ").append(getN()).append(endl); outBuffer.append("min: ").append(getMin()).append(endl); outBuffer.append("max: ").append(getMax()).append(endl); outBuffer.append("mean: ").append(getMean()).append(endl); outBuffer.append("std dev: ").append(getStandardDeviation()) .append(endl); try { outBuffer.append("median: ").append(getPercentile(50)).append(endl); } catch (MathIllegalStateException ex) { outBuffer.append("median: unavailable").append(endl); } outBuffer.append("skewness: ").append(getSkewness()).append(endl); outBuffer.append("kurtosis: ").append(getKurtosis()).append(endl); return outBuffer.toString(); } DescriptiveStatistics();  DescriptiveStatistics(int window);  DescriptiveStatistics(double[] initialDoubleArray);  DescriptiveStatistics(DescriptiveStatistics original); void addValue(double v); void removeMostRecentValue(); double replaceMostRecentValue(double v); double getMean(); double getGeometricMean(); double getVariance(); double getPopulationVariance(); double getStandardDeviation(); double getSkewness(); double getKurtosis(); double getMax(); double getMin(); long getN(); double getSum(); double getSumsq(); void clear(); int getWindowSize(); void setWindowSize(int windowSize); double[] getValues(); double[] getSortedValues(); double getElement(int index); double getPercentile(double p); @Override String toString(); double apply(UnivariateStatistic stat); synchronized UnivariateStatistic getMeanImpl(); synchronized void setMeanImpl(UnivariateStatistic meanImpl); synchronized UnivariateStatistic getGeometricMeanImpl(); synchronized void setGeometricMeanImpl(
            UnivariateStatistic geometricMeanImpl); synchronized UnivariateStatistic getKurtosisImpl(); synchronized void setKurtosisImpl(UnivariateStatistic kurtosisImpl); synchronized UnivariateStatistic getMaxImpl(); synchronized void setMaxImpl(UnivariateStatistic maxImpl); synchronized UnivariateStatistic getMinImpl(); synchronized void setMinImpl(UnivariateStatistic minImpl); synchronized UnivariateStatistic getPercentileImpl(); synchronized void setPercentileImpl(UnivariateStatistic percentileImpl); synchronized UnivariateStatistic getSkewnessImpl(); synchronized void setSkewnessImpl(
            UnivariateStatistic skewnessImpl); synchronized UnivariateStatistic getVarianceImpl(); synchronized void setVarianceImpl(
            UnivariateStatistic varianceImpl); synchronized UnivariateStatistic getSumsqImpl(); synchronized void setSumsqImpl(UnivariateStatistic sumsqImpl); synchronized UnivariateStatistic getSumImpl(); synchronized void setSumImpl(UnivariateStatistic sumImpl); DescriptiveStatistics copy(); static void copy(DescriptiveStatistics source, DescriptiveStatistics dest); static final int INFINITE_WINDOW; }
@Test public void testToString() { DescriptiveStatistics stats = createDescriptiveStatistics(); stats.addValue(1); stats.addValue(2); stats.addValue(3); Locale d = Locale.getDefault(); Locale.setDefault(Locale.US); Assert.assertEquals("DescriptiveStatistics:\n" + "n: 3\n" + "min: 1.0\n" + "max: 3.0\n" + "mean: 2.0\n" + "std dev: 1.0\n" + "median: 2.0\n" + "skewness: 0.0\n" + "kurtosis: NaN\n", stats.toString()); Locale.setDefault(d); }