Here you can find the source of sum(double... values)
Parameter | Description |
---|---|
values | Values. |
public static double sum(double... values)
//package com.java2s; //License from project: Apache License public class Main { /**/* w w w . j a va 2 s.c om*/ * Sums up the values. * @param values Values. * @return Sum. */ public static double sum(double... values) { double sum = 0.0d; for (double val : values) sum += val; return sum; } /** * Sums up the values. * @param values Values. * @return Sum. */ public static int sum(int... values) { int sum = 0; for (int value : values) sum += value; return sum; } }