Here you can find the source of sum(Integer[] array)
public static int sum(Integer[] array)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static int sum(Integer[] array) { int x = 0; for (int i = 0; i < array.length; i++) { x += array[i];//from w w w. j a v a2s .co m } return x; } public static int sum(ArrayList<Integer> list) { int x = 0; for (int i = 0; i < list.size(); i++) { x += list.get(i); } return x; } }