Java Array Sum sum(int[] intArray)

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

Description

sum

License

Open Source License

Declaration

public static double sum(int[] intArray) 

Method Source Code


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

import java.util.Arrays;

public class Main {
    public static double sum(int[] intArray) {
        double[] doubleArray = Arrays.stream(intArray).asDoubleStream().toArray();
        return sum(doubleArray);
    }//from  w  w  w  .ja va2 s  .co m

    public static double sum(double[] doubleArray) {
        // Sum the elements in a double array
        double arraySum = 0;
        for (double d : doubleArray) {
            arraySum += d;
        }
        return arraySum;
    }
}

Related

  1. sum(int[] array)
  2. sum(int[] array)
  3. sum(int[] array)
  4. sum(int[] array)
  5. sum(int[] array)
  6. sum(int[] ints)
  7. sum(int[] list)
  8. sum(int[] numbers)
  9. sum(int[] source)