package pl.wroc.pwr.statistic; import java.util.Arrays; import pl.wroc.pwr.IOperator1P; public class Quantile implements IOperator1P { private float value; public Quantile(float value) { this.value = value; } public Float apply(float[] sample) { if (sample.length > 0) { Arrays.sort(sample); int index = (int)(sample.length * this.value); return sample[index]; } else return Float.NaN; } }