public static double iqr(final double[] data){
  Arrays.sort(data);
  int q1=(int)Math.round(0.25 * (data.length + 1)) - 1;
  int q3=(int)Math.round(0.75 * (data.length + 1)) - 1;
  return data[q3] - data[q1];
}

public static double iqr ( final double [ ] data ) { Arrays . sort ( data ) ; int q1 = ( int ) Math . round ( 0.25 * ( data . length + 1 ) ) - 1 ; int q3 = ( int ) Math . round ( 0.75 * ( data . length + 1 ) ) - 1 ; return data [ q3 ] - data [ q1 ] ; }
gets the interquartile range ( iqr ) from an array of numbers .
