public static long quantile(long[] values,double quantile){
  if (values == null)   throw new IllegalArgumentException("Values cannot be null.");
  if (quantile < 0.0 || quantile > 1.0)   throw new IllegalArgumentException("Quantile must be between 0.0 and 1.0");
  long[] copy=new long[values.length];
  System.arraycopy(values,0,copy,0,copy.length);
  Arrays.sort(copy);
  int index=(int)(copy.length * quantile);
  return copy[index];
}

public static long quantile ( long [ ] values , double quantile ) { if ( values == null ) throw new IllegalArgumentException ( "Values cannot be null." ) ; if ( quantile < 0.0 || quantile > 1.0 ) throw new IllegalArgumentException ( "Quantile must be between 0.0 and 1.0" ) ; long [ ] copy = new long [ values . length ] ; System . arraycopy ( values , 0 , copy , 0 , copy . length ) ; Arrays . sort ( copy ) ; int index = ( int ) ( copy . length * quantile ) ; return copy [ index ] ; }
compute the requested quantile of the given array
