MetricHistogram implements Serializable, SerializationSchema<MetricHistogram> { public Double avg() { if (values.size() == 0) { return 0.0D; } return sum() / count(); }  void initialize(String metric, List<Tag> tags); boolean isInitialized(); String getMetric(); List<Tag> getTags(); long getTimestamp(); void update(Double d, long timestamp); void done(); Double avg(); Double min(); Double max(); Double getPercentile(int p); Double count(); Double sum(); @Override String toString(); byte[] serialize(MetricHistogram histo);  }
@Test public void testAvg() throws Exception { int sum = 0; for (int i = 1; i <= 100; i++) { sum += i; } Assert.assertEquals((sum / 100.0D), m.avg(), 0.0D); }