Java Array Sum sumUpArray(int[] array)

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

Description

sum Up Array

License

Open Source License

Declaration

public static int sumUpArray(int[] array) 

Method Source Code

//package com.java2s;
/**//w  w w .j  av a  2 s  .c om
 * Title:        efa - elektronisches Fahrtenbuch f?r Ruderer
 * Copyright:    Copyright (c) 2001-2011 by Nicolas Michael
 * Website:      http://efa.nmichael.de/
 * License:      GNU General Public License v2
 *
 * @author Nicolas Michael
 * @version 2
 */

public class Main {
    public static int sumUpArray(int[] array) {
        if (array == null) {
            return 0;
        }
        int sum = 0;
        for (int element : array) {
            sum += element;
        }
        return sum;
    }
}

Related

  1. sumProd(double[] v1, double[] v2, int i_, int n_)
  2. sumRightShifts(int num, int... shifts)
  3. sumSquared(double[] a)
  4. sumToDouble(float[] array)
  5. sumToLong(byte[] array)
  6. sumValues(double[] vector)