MetricHistogram implements Serializable, SerializationSchema<MetricHistogram> { public Double getPercentile(int p) { if (values.size() == 0) { return 0.0D; } int position = Math.round((p * 1.0f / 100) * values.size()); position = (0 == position) ? 0 : position - 1; return values.get(position); }  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 test50thPercentile() throws Exception { Assert.assertEquals(50.0D, m.getPercentile(50), 0.0D); }
@Test public void test75thPercentile() throws Exception { Assert.assertEquals(75.0D, m.getPercentile(75), 0.0D); }
@Test public void test90thPercentile() throws Exception { Assert.assertEquals(90.0D, m.getPercentile(90), 0.0D); }
@Test public void test99thPercentile() throws Exception { Assert.assertEquals(99.0D, m.getPercentile(99), 0.0D); }