Here you can find the source of mean(ArrayList
static Double mean(ArrayList<Double> values)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { static Double mean(ArrayList<Double> values) { return sum(values) / values.size(); }// w w w. j ava 2 s .c o m private static Double sum(ArrayList<Double> values) { Double sum = 0.0; for (Double num : values) { sum += num; } return sum; } }