Here you can find the source of sum(int[] list)
public static int sum(int[] list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static int sum(int[] list) { int sum = 0; for (int x : list) sum += x;/*w ww . j a v a2s . c om*/ return sum; } public static double sum(double[] list) { double sum = 0; for (double x : list) sum += x; return sum; } public static double sum(double[][] list) { double sum = 0; for (double[] x : list) sum += sum(x); return sum; } public static double sum(List<Double> list) { double sum = 0; for (double x : list) sum += x; return sum; } }