Java Array Sum arraySum(double[] a)

Here you can find the source of arraySum(double[] a)

Description

Sum up array

License

Open Source License

Parameter

Parameter Description
a a parameter

Declaration

public static Double arraySum(double[] a) 

Method Source Code

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

public class Main {
    /**/*from  w  w  w . j  a v a 2s . c om*/
     * Sum up array
     * 
     * @param a
     * @return
     */
    public static Double arraySum(double[] a) {
        if (a == null)
            return 0.0;
        if (a.length == 0)
            return 0.0;

        double ret = 0.0;

        for (int i = 0; i < a.length; i++) {
            ret += a[i];
        }

        return ret;
    }
}

Related

  1. arrayAdd(int[] sumFreq, int[] freq)
  2. ArrayCeilSum(float[] a)
  3. arraySum(double[] arr)
  4. arraySum(final double input[])
  5. ArraySum(float[] a)
  6. arraySum(int[] intArray, short flag)