Java Utililty Methods Array Sum

List of utility methods to do Array Sum

Description

The list of methods to do Array Sum are organized into topic(s).

Method

intsum(final int[] terms, final int start, final int len)
sum
int s = 0;
final int iSz = start + len;
for (int i = start; i < iSz; i++) {
    s += terms[i];
return s;
intsum(final int[] values)
Computes the sum of an array of integers.
int t = 0;
for (int i : values) {
    t += i;
return t;
intsum(final int[] values, final int... indice)
sum
int result = 0;
for (int i = 0; i < indice.length; i++) {
    result += values[indice[i]];
return result;
longsum(final long... values)
sum
long result = 0;
for (final long value : values)
    result += value;
return result;
floatsum(float[] a, int off, int length)
sum
double d = 0.0;
final int stop = off + length;
while (off < stop)
    d += a[off++];
return (float) d;
floatsum(float[] array)
Sums all elements of array
float sum = 0;
for (int i = 0; i < array.length; i++) {
    sum += array[i];
return sum;
floatsum(float[] distribution)
sum
float result = 0;
for (float val : distribution)
    result += val;
return result;
floatsum(float[] items, int offset, int length)
sum
float sum = 0;
for (int i = offset; i < offset + length; i++)
    sum += items[i];
return sum;
doublesum(float[] vector)
sum
double sum = 0;
for (double d : vector)
    sum += d;
return sum;
longsum(int... values)
Calculate the sum of the values from the specified array.
long r = 0;
for (int v : values) {
    r += v;
return r;