Java mean mean(double[] a)

Here you can find the source of mean(double[] a)

Description

computes the mean of a double array

License

Open Source License

Parameter

Parameter Description
a the array

Return

the mean

Declaration

public static double mean(double[] a) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   w w w .j a va  2s.co  m*/
     * computes the mean of a double array
     * @param a the array
     * @return the mean
     */
    public static double mean(double[] a) {
        double sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }
        return sum / (double) a.length;
    }
}

Related

  1. mean(double v1, double v2)
  2. mean(double values[])
  3. mean(Double[] a)
  4. mean(double[] a)
  5. mean(double[] a)
  6. mean(double[] a, double[] b)
  7. mean(double[] a, double[] b)
  8. mean(double[] a, int from, int to)
  9. mean(double[] a, int n)