Java Utililty Methods mean

List of utility methods to do mean

Description

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

Method

doublemean(double[] a, int n)
Returns the mean.
double avg = 0.0;
for (double v : a) {
    avg += v;
return avg / n;
doublemean(double[] aArray)
Computes the arithmetic mean of the values in the given array.
return sum(aArray) / aArray.length;
doublemean(double[] an)
mean
if (an == null) {
    throw new NullPointerException("Array cannot be null");
if (an.length == 0) {
    throw new IllegalArgumentException("Array has zero length");
double sum = 0.0;
for (int n = 0; n < an.length; n++) {
...
doublemean(double[] arr)
mean
if (arr == null || arr.length == 0)
    return 0;
return sum(arr) / arr.length;
doublemean(double[] array)
mean
if (array.length == 0)
    throw new IllegalArgumentException("length cannot be 0.");
double sum = 0;
for (double d : array) {
    sum += d;
return sum / array.length;
doublemean(Double[] array)
Returns the mean of values in an array
return sum(array) / array.length;
doublemean(double[] data)
Compute the mean of all elements in the array.
double mean = 0;
for (int i = 0; i < data.length; i++) {
    if (Double.isNaN(data[i]))
        throw new IllegalArgumentException("NaN not allowed in mean calculation");
    mean += data[i];
mean /= data.length;
return mean;
...
doublemean(double[] data)
mean
return mean(data, 0, data.length - 1);
doublemean(double[] doubleArray)
mean
return _sum(doubleArray) / doubleArray.length;
doublemean(double[] list)
mean
return sum(list) / list.length;