code: private Double findPivot(Map<Long, Double> datapoints, Double limit) {
          double[] doubleValues = new double[datapoints.size()];
          int k = 0;
  
          for (Map.Entry<Long, Double> entry : datapoints.entrySet()) {
              doubleValues[k] = entry.getValue();
              k++;
          }
          Arrays.sort(doubleValues);
  
          double pivotValue = Double.MAX_VALUE;
  
          try {
              pivotValue = new Percentile().evaluate(doubleValues, (double) limit);
          } catch (IllegalArgumentException e) {
              throw new IllegalArgumentException("Please provide a valid percentile number!");
          }
          return pivotValue;
      }
docs: /*
  If type is percentile, find out the estimate of the limit(th) percentile in the datapoint sorted values. Then execute the same as type is
  value. That means to cull the elements greater than value or pivotValue prerequisite: array must be sorted