Here you can find the source of mean(ArrayList
public static <T extends Number> double mean(ArrayList<T> a)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static <T extends Number> double mean(ArrayList<T> a) { return sum(a) / a.size(); }/*w w w.j a v a 2 s.c o m*/ public static <T extends Number> double sum(ArrayList<T> a) { double sum = 0; for (int i = 0; i < a.size(); i++) sum += a.get(i).doubleValue(); return sum; } }