Java Array Sum sum(double[] array)

Here you can find the source of sum(double[] array)

Description

sum

License

Open Source License

Declaration

public static double sum(double[] array) 

Method Source Code

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

public class Main {
    public static double sum(double[] array) {
        return sum(array, array.length);
    }/*from  w  ww. ja  v  a 2  s. co  m*/

    public static double sum(double[] array, int len) {
        assert len > 0;
        assert len <= array.length;
        double s = 0;
        for (int i = 0; i < len; ++i) {
            s += array[i];
        }
        return s;
    }

    public static double sum(int[] array) {
        double s = 0;
        for (int i = 0; i < array.length; ++i) {
            s += array[i];
        }
        return s;
    }
}

Related

  1. sum(Double[] array)
  2. sum(double[] array)
  3. sum(double[] array)
  4. sum(double[] array)
  5. sum(double[] array)
  6. sum(double[] d)
  7. sum(double[] data)
  8. sum(double[] data)
  9. sum(double[] data, int i_, int n_)