Here you can find the source of average(double[] values)
public static double average(double[] values)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static double average(Collection<Double> values) { double ret = 0; for (Double val : values) ret += val; return ret / values.size(); }//from ww w . j av a2 s.c o m public static double average(double[] values) { double ret = 0; for (int i = 0; i < values.length; i++) ret += values[i]; return ret / values.length; } }