Java Array Sum sum(Integer... ints)

Here you can find the source of sum(Integer... ints)

Description

sum

License

Open Source License

Declaration

public static Integer sum(Integer... ints) 

Method Source Code

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

public class Main {
    public static Integer sum(Integer... ints) {
        Integer res = null;//from   w w w .j a v  a2 s  . c  o  m

        for (Integer i : ints) {
            if (null != i) {
                if (res == null) {
                    res = i;
                } else {
                    res = res + i;
                }
            }
        }

        return res;
    }
}

Related

  1. sum(int[] values)
  2. sum(int[] values)
  3. sum(int[] values, int begin, int end)
  4. sum(int[] values, int startIndex, int stopIndex)
  5. sum(Integer... integers)
  6. sum(Integer[] array)
  7. sum(long array[])
  8. sum(long... values)
  9. sum(long[] array)