<dependencies>
<dependency>
<groupId>org.hdrhistogram</groupId>
<artifactId>HdrHistogram</artifactId>
<version>2.1.12</version>
</dependency>
</dependencies>
Histogram histogram = new Histogram(1L, TimeUnit.NANOSECONDS.toMicros(1L), 3);
Random random = new Random();
for (int i = 0; i < 1000; i++) {
long delay = Math.abs(random.nextLong());
histogram.recordValue(delay);
}
HistogramData histogramData = histogram.getHistogramData();
long maxDelay = histogramData.getMaxValue();
long minDelay = histogramData.getMinValue();
double avgDelay = histogramData.getMeanValue();