Java Array Sum sum(double[] x, int length)

Here you can find the source of sum(double[] x, int length)

Description

sum

License

BSD License

Declaration

public static double sum(double[] x, int length) 

Method Source Code

//package com.java2s;
//License from project: BSD License 

public class Main {
    public static double sum(double[] x, int length) {
        double s = 0;
        for (int i = 0; i < length; i++)
            s += x[i];/*from  w  w w . j a  v a  2s . c  o  m*/
        return s;
    }

    public static double sum(double[] x) {
        return sum(x, x.length);
    }

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

    public static double sum(int[] x) {
        return sum(x, x.length);
    }
}

Related

  1. sum(double[] output, double[] a, double[] b)
  2. sum(double[] t)
  3. sum(double[] vec1, double[] vec2)
  4. sum(double[] vector)
  5. sum(double[] x)
  6. sum(double[] x, int start, int end)
  7. sum(double[] xs)
  8. sum(final byte[] array)
  9. sum(final double... values)