Java Array Sum sum(double[] t)

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

Description

sum

License

Open Source License

Declaration

static public double sum(double[] t) 

Method Source Code

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

public class Main {
    static public double sum(double[] t) {
        if (t == null) {
            System.err.println("empty array sum");
            return 0;
        } else {/*from   w  w  w .j  ava2s . c o m*/
            double sum = 0;
            for (int i = 0; i < t.length; i++) {
                sum = sum + t[i];
            }
            return sum;
        }

    }
}

Related

  1. sum(double[] data)
  2. sum(double[] data)
  3. sum(double[] data, int i_, int n_)
  4. sum(double[] dbs)
  5. sum(double[] output, double[] a, double[] b)
  6. sum(double[] vec1, double[] vec2)
  7. sum(double[] vector)
  8. sum(double[] x)
  9. sum(double[] x, int length)