Here you can find the source of getMeanValue(ArrayList
public static double getMeanValue(ArrayList<Double> values)
//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(); } }