public static double median(final double[] values){
  final int len=values.length;
  final double[] sortedValues=Arrays.copyOf(values,len);
  Arrays.sort(sortedValues);
  if (len % 2 == 0) {
    return ((double)sortedValues[len / 2] + (double)sortedValues[len / 2 - 1]) / 2;
  }
 else {
    return (double)sortedValues[len / 2];
  }
}

public static double median ( final double [ ] values ) { final int len = values . length ; final double [ ] sortedValues = Arrays . copyOf ( values , len ) ; Arrays . sort ( sortedValues ) ; if ( len % 2 == 0 ) { return ( ( double ) sortedValues [ len / 2 ] + ( double ) sortedValues [ len / 2 - 1 ] ) / 2 ; } else { return ( double ) sortedValues [ len / 2 ] ; } }
computes the median of the values in the input array .
