code: public double evaluate(final double[] values, final int begin, 
              final int length, final double p) {
  
          test(values, begin, length);
  
          if ((p > 100) || (p <= 0)) {
              throw new IllegalArgumentException("invalid quantile value: " + p);
          }
          if (length == 0) {
              return Double.NaN;
          }
          if (length == 1) {
              return values[begin]; // always return single value for n = 1
          }
  
          // Sort array
          double[] sorted = new double[length];
          System.arraycopy(values, begin, sorted, 0, length);
          Arrays.sort(sorted);
  
          return evaluateSorted( sorted, p );
      }
docs: Returns an estimate of the <code>p</code>th percentile of the values
  in the <code>values</code> array, starting with the element in (0-based)
  position <code>begin</code> in the array and including <code>length</code>
  values.
  <p>
  Calls to this method do not modify the internal <code>quantile</code>
  state of this statistic.
  <p>
  <ul>
  <li>Returns <code>Double.NaN</code> if <code>length = 0</code></li>
  <li>Returns (for any value of <code>p</code>) <code>values[begin]</code>
  if <code>length = 1 </code></li>
  <li>Throws <code>IllegalArgumentException</code> if <code>values</code>
  is null , <code>begin</code> or <code>length</code> is invalid, or
  <code>p</code> is not a valid quantile value</li>
  </ul>
  <p>
  See {@link Percentile} for a description of the percentile estimation
  algorithm used.
  
  @param values array of input values
  @param p  the percentile to compute
  @param begin  the first (0-based) element to include in the computation
  @param length  the number of array elements to include
  @return  the percentile value
  @throws IllegalArgumentException if the parameters are not valid or the
  input array is null