List of utility methods to do Array Average
double | average(double[] array) average return average(array, array.length);
|
double | average(double[] d) Mittelwertberechnung. double average = average1(d); if (Double.isNaN(average) || Double.isInfinite(average)) return average2(d); return average; |
double | average(double[] values) Get the average of an array of values. double sum = 0; if (values.length == 0) { throw new IllegalArgumentException("Array length must be > 0"); for (int i = 0; i < values.length; i++) { sum += values[i]; return sum / values.length; ... |
double | average(double[] values) average double ret = 0; for (int i = 0; i < values.length; i++) ret += values[i]; return ret / values.length; |
double | average(double[] values) Returns the average (mean) of the given values. double result = 0; if (values == null) { throw new IllegalArgumentException("Cannot calculate average on a null object."); if (values.length == 0) { return 0; } else { for (Number n : values) { ... |
double | average(final double[] values) average double average = 0; for (final double value : values) { average += value; final int divisor = values.length == 0 ? 1 : values.length; return average / divisor; |
float | average(final Float... values) average float total = 0.0F; for (final Float val : values) total += val; return total / values.length; |
float | average(final float[] values) average final double size = values.length; double avg = 0; for (final float v : values) avg += v / size; return (float) avg; |
int | average(final int totalAmount, final int orderCount) average return orderCount == 0 ? 0 : Math.round((100.0f * totalAmount / orderCount) / 100);
|
Double | average(final T p_num1, final T p_num2) average if (p_num1 == null) { return p_num2 == null ? null : p_num2.doubleValue(); if (p_num2 == null) { return p_num1.doubleValue(); return (p_num1.doubleValue() + p_num2.doubleValue()) / 2.0; |