Java Array Sum sum(double... values)

Here you can find the source of sum(double... values)

Description

Sums up the values.

License

Apache License

Parameter

Parameter Description
values Values.

Return

Sum.

Declaration

public static double sum(double... values) 

Method Source Code

//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;
    }
}

Related

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