Here you can find the source of average(List
public static double average(List<Double> observations)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static double average(List<Double> observations) { double total = 0.0; for (double d : observations) { total += d;//from w ww. j a v a 2 s . c o m } return total / observations.size(); } public static double average(double[] data) { double total = 0.0; for (double d : data) { total += d; } return total / data.length; } }