Here you can find the source of average(final double[] values)
private static double average(final double[] values)
//package com.java2s; //License from project: Apache License public class Main { private static double average(final double[] values) { double average = 0; for (final double value : values) { average += value;//from ww w . ja v a 2s. com } final int divisor = values.length == 0 ? 1 : values.length; return average / divisor; } }