Java Mean Calculation calculateMean(double[] values)

Here you can find the source of calculateMean(double[] values)

Description

calculate Mean

License

Open Source License

Declaration

public static double calculateMean(double[] values) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double calculateMean(double[] values) {
        return calculateSum(values) / (double) values.length;
    }/*  w  w w . j av a  2  s.c  o m*/

    public static double calculateSum(double[] values) {
        double sum = 0;
        for (double value : values) {
            sum += value;
        }
        return sum;
    }
}

Related

  1. calculateMean(float[] data)
  2. calculateMeanAndStandardDeviation(float[] data)
  3. calculateMeanAndStandardDeviationIgnoreNegatives( float[] data)
  4. calculateMeanAndStandardDeviationVectors( float[][] vectors)