Answers for "calculate the percentile i java"

-1

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;
  }
Posted by: Guest on May-25-2020

Code answers related to "calculate the percentile i java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language