Here you can find the source of average(final float[] values)
public static float average(final float[] values)
//package com.java2s; public class Main { public static float average(final float[] values) { final double size = values.length; double avg = 0; for (final float v : values) avg += v / size;//from w ww. j a v a 2 s . c o m return (float) avg; } public static double average(final double[] values) { final double size = values.length; double avg = 0; for (final double v : values) avg += v / size; return avg; } }