Java Array Sum sum(int[] array)

Here you can find the source of sum(int[] array)

Description

sum

License

Apache License

Declaration

public static int sum(int[] array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int sum(int[] array) {
        int sum = 0;
        for (int e : array) {
            sum += e;/*from  ww w . java 2 s .c o  m*/
        }
        return sum;
    }

    public static long sum(long[] array) {
        long sum = 0;
        for (long e : array) {
            sum += e;
        }
        return sum;
    }
}

Related

  1. sum(int[] arr)
  2. sum(int[] arr)
  3. sum(int[] arr)
  4. sum(int[] array)
  5. sum(int[] array)
  6. sum(int[] array)
  7. sum(int[] array)
  8. sum(int[] intArray)
  9. sum(int[] ints)