Java mean getMeanValue(ArrayList values)

Here you can find the source of getMeanValue(ArrayList values)

Description

get Mean Value

License

Open Source License

Declaration

public static double getMeanValue(ArrayList<Double> values) 

Method Source Code


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

import java.util.ArrayList;

public class Main {
    public static double getMeanValue(ArrayList<Double> values) {
        if (values.isEmpty()) {
            return -1.0;
        }// w ww.  j a  v a  2  s .  com

        double sum = 0.0;
        for (Double value : values) {
            sum += value;
        }

        return sum / values.size();
    }
}

Related

  1. adjustVariance(double[] x, double newVariance, double currentMean)
  2. calculateMeanOfArrayListDouble(List dList)
  3. getMean(ArrayList> lists)
  4. getMean(ArrayList beats)
  5. getMean(final Integer[] values)
  6. Mean(ArrayList values)
  7. mean(Collection terms)
  8. mean(double a, double b)
  9. mean(double ask, double bid)