Here you can find the source of average(List
public static double average(List<Double> list)
//package com.java2s; //License from project: GNU General Public License import java.util.List; public class Main { public static double average(List<Double> list) { return sum(list) / list.size(); }//from w w w . j av a2s . c om public static double sum(List<Double> list) { double sum = 0.0; for (double v : list) { sum += v; } return sum; } public static double sum(double[][] a) { double sum = 0.0; for (int i = 0; i < a.length; i++) { sum += sum(a[i]); } return sum; } public static double sum(double[] a) { double sum = 0.0; for (int i = 0; i < a.length; i++) { sum += a[i]; } return sum; } public static int sum(int[] a) { int sum = 0; for (int i = 0; i < a.length; i++) { sum += a[i]; } return sum; } }