Q:

Java api for calculating Interquartile range

Is there any java api for calculating interquartile range? I was wondering apache commons math library contains all the stats function like mean, median, mode but i could not find any thing for IQR.

A:

I'm not sure, but maybe you can use getPercentile from DescriptiveStatistics class of Apache Commons Math, like in the following code sample.
double[] data = // obtain data here
DescriptiveStatistics da = new DescriptiveStatistics(data);
double iqr = da.getPercentile(75) - da.getPercentile(25);

