Here you can find the source of sum(double values[], int size)
public final static double sum(double values[], int size)
//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; } }