Here you can find the source of sum(double[] xs)
public static double sum(double[] xs)
//package com.java2s; //License from project: Open Source License public class Main { public static int sum(int[] xs) { int result = 0; for (int x : xs) result += x;/*from w ww . j a v a2s. co m*/ return result; } public static double sum(double[] xs) { double result = 0.0; for (double x : xs) result += x; return result; } }