private static int percentileIndex(double percentile, int size) {

        // x.5 should be rounded down
        return (int) -Math.round(-(size * percentile + 0.5)) - 1;
    }
Get a {@link Collector} that calculates the derived <code>PERCENTILE_DISC(percentile)</code> function given a specific ordering, producing multiple results.
jOOL/src/main/java/org/jooq/lambda/Agg.java