Java Mean Calculate mean(Double... values)

Here you can find the source of mean(Double... values)

Description

mean

License

Apache License

Declaration

public static double mean(Double... values) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Arrays;
import java.util.List;

public class Main {
    public static double mean(Double... values) {
        return mean(Arrays.asList(values));

    }//w w w.ja  v  a  2 s. c  o m

    public static double mean(List<Double> elems) {
        double sum = 0;

        for (Double d : elems) {
            sum += d;
        }

        return sum / elems.size();
    }
}

Related

  1. computeMean(int[][] pixels)
  2. computeMeanSquaredError(double[] trueValues, double[] predValues)
  3. computeMeanSquareError(double[] x, double[] y)
  4. mean(ArrayList values)
  5. mean(ArrayList a)