Here you can find the source of median(double[] array)
public static double median(double[] array)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static double median(double[] array) { Arrays.sort(array);/*from www . j a v a 2s . c o m*/ double median; if (array.length % 2 == 0) median = (array[array.length / 2] + array[array.length / 2 - 1]) / 2; else median = array[array.length / 2]; return median; } }