StatsBuffer { public void record(long n) { values[Integer.remainderUnsigned(pos++, size)] = n; if (curSize < size) { ++curSize; } } StatsBuffer(int size, double[] percentiles); void reset(); void record(long n); void computeStats(); int getCount(); double getMean(); double getVariance(); double getStdDev(); long getMin(); long getMax(); long getTotalTime(); double[] getPercentileValues(); double[] getPercentiles(); double getPercentileValueForIdx(int index);  }
@Test public void testCountOverflow() throws Exception { StatsBuffer buffer = new StatsBuffer(SIZE, PERCENTILES); setCount(buffer, Integer.MAX_VALUE); buffer.record(1); buffer.record(2); }