Here you can find the source of getAverage(ArrayList
static public double getAverage(ArrayList<Double> values)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { static public double getAverage(ArrayList<Double> values) { double sum = 0; for (double value : values) { sum += value;/*from w ww . j a v a 2 s .com*/ } return sum / values.size(); } }