Here you can find the source of average(List
public static double average(List<Double> arr)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static double average(List<Double> arr) { double sum = 0.0d; int count = 0; for (int i = 0; i < arr.size(); i++) { if (!Double.isNaN(arr.get(i))) { sum += arr.get(i);/*from w w w. j a va 2s .c om*/ count++; } } return sum / ((double) count); } }