Java Array Sum sum(int[] a)

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

Description

sum

License

Open Source License

Declaration

public static int sum(int[] a) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int sum(int[] a) {
        int s = 0;
        for (int x : a)
            s += x;//from w ww.ja  v a  2s.c om
        return s;
    }

    public static int sum(int[][] a) {
        int s = 0;
        for (int[] x : a)
            s += sum(x);
        return s;
    }

    public static int sum(int[][][] a) {
        int s = 0;
        for (int[][] x : a)
            s += sum(x);
        return s;
    }
}

Related

  1. sum(float[] vector)
  2. sum(int... values)
  3. sum(int... xs)
  4. sum(int[] a)
  5. sum(int[] a)
  6. sum(int[] a)
  7. sum(int[] add)
  8. sum(int[] arr)
  9. sum(int[] arr)