Here you can find the source of sum(int[] array)
Parameter | Description |
---|---|
array | a parameter |
public static int sum(int[] array)
//package com.java2s; public class Main { /**/*from w ww. jav a 2s .com*/ * Returns the sum of all elements of the given array. * * @param array * @return */ public static int sum(int[] array) { int sum = 0; for (int i : array) { sum += i; } return sum; } }