Java Array Sum sum(final long... values)

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

Description

sum

License

Open Source License

Declaration

public static long sum(final long... values) 

Method Source Code

//package com.java2s;
/**//from www  . j  a  v  a  2s  .c  o  m
 * Copyright? 2014-2016 LIST (Luxembourg Institute of Science and Technology), all right reserved.
 * Authorship : Olivier PARISOT, Yoanne DIDRY
 * Licensed under GNU General Public License version 3
 */

public class Main {
    public static double sum(final double... values) {
        double result = 0d;
        for (final double value : values)
            result += value;
        return result;
    }

    public static long sum(final long... values) {
        long result = 0;
        for (final long value : values)
            result += value;
        return result;
    }
}

Related

  1. sum(final float[] x)
  2. sum(final int base, final int[] ints)
  3. sum(final int[] terms, final int start, final int len)
  4. sum(final int[] values)
  5. sum(final int[] values, final int... indice)
  6. sum(float[] a, int off, int length)
  7. sum(float[] array)
  8. sum(float[] distribution)
  9. sum(float[] items, int offset, int length)