Java Median median(double[] array)

Here you can find the source of median(double[] array)

Description

median

License

Open Source License

Declaration

public static double median(double[] array) 

Method Source Code

//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;
    }
}

Related

  1. median(double... a)
  2. median(double[] a)
  3. median(double[] a)
  4. median(double[] arr)
  5. median(double[] array)
  6. median(double[] data)
  7. median(double[] data, int length)
  8. median(double[] input)
  9. median(double[] l)