Java Array Sum sum(double values[], int size)

Here you can find the source of sum(double values[], int size)

Description

sum

License

Apache License

Declaration

public final static double sum(double values[], int size) 

Method Source Code

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

public class Main {

    public final static double sum(double values[], int size) {
        if (values == null) {
            return Double.NaN;
        }//from   w w w. j a v  a  2s.c om

        if (size == 0) {
            return 0;
        }
        double r = 0;
        for (int i = 0; i < size; i++) {
            double v = values[i];
            if (!Double.isNaN(v)) {
                r += v;
            }
        }
        return r;
    }
}

Related

  1. sum(byte[] array)
  2. sum(byte[] array, int offset, int size)
  3. sum(byte[] array, int offset, int size)
  4. sum(byte[] in, byte[] gamma)
  5. sum(double a[], int begin, int end)
  6. sum(double... a)
  7. sum(double... values)
  8. sum(double... values)
  9. sum(double[] a)