Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

calculating the percentile in java

  public static long[] percentiles(long[] latencies, double... percentiles) {
    Arrays.sort(latencies, 0, latencies.length);
    long[] values = new long[percentiles.length];
    for (int i = 0; i < percentiles.length; i++) {
      int index = (int) (percentiles[i] * latencies.length);
      values[i] = latencies[index];
    }
    return values;
  }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #calculating #percentile #java
ADD COMMENT
Topic
Name
1+6 =