How to Find Interquartile Range in Java
In this post, I explained how to find quartiles in a list of numbers. As a slight add-on to that functionality, you can easily get the interquartile range. This basically means that you are finding the difference between the first and third quartiles.
So I use the code to compute the quartiles and then use simple math to subtract the difference.
public static double InterQuartileRange(ArrayList values) throws Exception { double[] quartiles = Quartiles(values); return quartiles[2] - quartiles[0]; }
