MathUtil { public static double iqr(final double... data) { Arrays.sort(data); final int quartile1 = (int) Math.round(0.25 * (data.length + 1)) - 1; final int quartile3 = (int) Math.round(0.75 * (data.length + 1)) - 1; return data[quartile3] - data[quartile1]; } private  MathUtil(); static double sum(final List<? extends Number> list); static double median(final Collection<Double> list); static double median(final double... list); static DescriptiveStatistics getStatistics(final Collection<Double> list); static DescriptiveStatistics getStatistics(final double... list); static double mean(final List<Double> list); static double variance(final List<Double> list); static double stDev(final List<Double> list); static double mad(final double... data); static double iqr(final double... data); static int countNonZeroBeginning(final double... data); static double[] getLoessParameterEstimates(final double... y); static SimpleRegression createLinearRegression(final double[] x, final double[] y); static OLSMultipleLinearRegression createLinearRegression(final double[][] x, final double[] y); static double[] getRobustLoessParameterEstimates(final double... y); static double[] getTricubeWeights(final int weightsNumber); static double[] getTricubeBisquareWeights(final double... residuals); static double[] abs(final double... data); static int doubleToInt(final double value); static int parseInt(final String value, final int defaultValue); static boolean same(final double first, final double second); static boolean same(final double first, final double second, final double precisionError); static List<Double> correlationCoefficients(final double[][] data); static final double HUNDRED_PERCENT; }
@Test public void testIqr1() { assertEquals(IQR1, MathUtil.iqr(DATA1)); }
@Test public void testIqr2() { assertEquals(IQR2, MathUtil.iqr(DATA2)); }