Here you can find the source of sum(int[] arr)
public static long sum(int[] arr)
//package com.java2s; //License from project: Open Source License public class Main { public static long sum(Long[] longs) { long sum = 0; for (long i : longs) { sum += i;/* w ww .j av a 2s . co m*/ } return sum; } public static long sum(int[] arr) { long sum = 0; for (int i : arr) { sum += i; } return sum; } public static double sum(double[] arr) { double sum = 0.0; for (double d : arr) { sum += d; } return sum; } public static double sum(Double[] arr) { double sum = 0.0; for (double d : arr) { sum += d; } return sum; } }