Percentile extends AbstractUnivariateStatistic implements Serializable { public Percentile() { this(50.0); } Percentile();  Percentile(final double quantile);  Percentile(final Percentile original); protected  Percentile(final double quantile,
                         final EstimationType estimationType,
                         final NaNStrategy nanStrategy,
                         final KthSelector kthSelector); @Override void setData(final double[] values); @Override void setData(final double[] values, final int begin, final int length); double evaluate(final double p); double evaluate(final double[] values, final double p); @Override double evaluate(final double[] values, final int start, final int length); double evaluate(final double[] values, final int begin,
                           final int length, final double p); double getQuantile(); void setQuantile(final double p); @Override Percentile copy(); @Deprecated static void copy(final Percentile source, final Percentile dest); EstimationType getEstimationType(); Percentile withEstimationType(final EstimationType newEstimationType); NaNStrategy getNaNStrategy(); Percentile withNaNStrategy(final NaNStrategy newNaNStrategy); KthSelector getKthSelector(); PivotingStrategyInterface getPivotingStrategy(); Percentile withKthSelector(final KthSelector newKthSelector);  }
@Test public void testPercentile() { final double[] d = new double[] {1, 3, 2, 4}; final Percentile p = new Percentile(30); Assert.assertEquals(1.5, p.evaluate(d), 1.0e-5); p.setQuantile(25); Assert.assertEquals(1.25, p.evaluate(d), 1.0e-5); p.setQuantile(75); Assert.assertEquals(3.75, p.evaluate(d), 1.0e-5); p.setQuantile(50); Assert.assertEquals(2.5, p.evaluate(d), 1.0e-5); try { p.evaluate(d, 0, d.length, -1.0); Assert.fail(); } catch (final MathIllegalArgumentException ex) { } try { p.evaluate(d, 0, d.length, 101.0); Assert.fail(); } catch (final MathIllegalArgumentException ex) { } }