public static double median(double[] v) {double r = Double.NaN;if (v!=null && v.length >= 1) {int n = v.length;Arrays.sort(v);r = (n % 2 == 0)? (v[n / 2] + v[n / 2 - 1]) / 2: v[n / 2];}return r;}

public static double median(double[] v){double r = double.NaN;if (v != null && v.Length >= 1){int n = v.Length;Array.Sort(v);r = (n % 2 == 0)? (v[n / 2] + v[n / 2 - 1]) / 2: v[n / 2];}return r;}
