public static double getMedian(double[] array)
{
int zaehlen = array.GetLength(0);
if (zaehlen == 0) return (0);
Array.Sort(array);
if ((zaehlen % 2) == 0)
return ((array[(int)(zaehlen / 2) - 1] + array[(int)(zaehlen / 2)]) / 2);
else
return (array[zaehlen / 2]);
}