Java Utililty Methods Array Average

List of utility methods to do Array Average

Description

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

Method

doubleavg(double[] values)
avg
if (values.length > 0) {
    return sum(values) / values.length;
} else {
    return 0.0;
doubleavg(double[] x, int start, int end)
avg
if (start >= end) {
    return 0;
return sum(x, start, end) / (end - start);
doubleavg(final double a, final double b)
avg
return (a + b) / 2d;
doubleavg(final double... values)
avg
return sum(values) / values.length;
floatavg(float... numbers)
avg
return sum(numbers) / numbers.length;
doubleavg(int... values)
Calculate the average of the values from the specified array.
long s = sum(values);
return ((double) s / values.length);
floatavg(int[] arr)
AVG all elements of the specified primitive type array.
return (float) sum(arr) / arr.length;
intavg(int[] values)
avg
if (values == null || values.length == 0) {
    return 0;
return sum(values) / values.length;
doubleavg(int[] xs)
avg
if (xs.length == 0)
    return 0.0;
else
    return ((double) sum(xs)) / xs.length;
double[]avg(int[][] values)
avg
int max = 0;
for (int i = 0; i < values.length; i++) {
    if (values[i].length > max) {
        max = values[i].length;
double[] avg = new double[max];
for (int i = 0; i < avg.length; i++) {
...