question: public static double [ ] quantiles ( int n , double [ ] values ) { values = ( double [ ] ) values . clone ( ) ; Arrays . sort ( values ) ; double [ ] qtls = new double [ n + 1 ] ; for ( int i = 0 ; i <= n ; ++ i ) { qtls [ i ] = values [ ( ( values . length - 1 ) * i ) / n ] ; } return qtls ; }
target:  Compute the n-quantile boundaries for a set of values. The result is an n+1 size array holding the minimum value in the first entry and then n quantile boundaries in the subsequent entries.