public synchronized final double getKPercentile(int k) throws IllegalArgumentException {
      if (k < 0 || k > 100) {
         throw new IllegalArgumentException(k + " should be between 0 and 100 exclusive");
      }
      double[] copy = createArray(reservoir.length);
      System.arraycopy(this.reservoir, 0, copy, 0, reservoir.length);
      Arrays.sort(copy);
      return copy[this.getIndex(k)];
   }
public synchronized final double getKPercentile ( int k ) throws IllegalArgumentException { if ( k < 0 || k > 100 ) { throw new IllegalArgumentException ( k + " should be between 0 and 100 exclusive" ) ; } double [ ] copy = createArray ( reservoir . length ) ; System . arraycopy ( this . reservoir , 0 , copy , 0 , reservoir . length ) ; Arrays . sort ( copy ) ; return copy [ this . getIndex ( k ) ] ; }
@param k the percentage of observations. Should be a value between 0 and 100 exclusively.
@return the percentile value for the k% observations.
@throws IllegalArgumentException if k is not between 0 and 100 exclusively.