Here you can find the source of sum(ArrayList
private static Double sum(ArrayList<Double> values)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { private static Double sum(ArrayList<Double> values) { Double sum = 0.0;//from www .ja v a2s . c om for (Double num : values) { sum += num; } return sum; } }