Here you can find the source of Sum(ArrayList
Parameter | Description |
---|---|
values | List of numeric values |
public static double Sum(ArrayList<Double> values)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.*; public class Main { /** Calculates the sum of a list of numeric values. */*w w w . j av a 2 s .c o m*/ * @param values List of numeric values * @return Summed value */ public static double Sum(ArrayList<Double> values) { double sum = 0.0; for (double value : values) sum += value; return sum; } }