Here you can find the source of average(double[] a)
public static double average(double[] a)
//package com.java2s; //License from project: Open Source License public class Main { public static double average(double[] a) { return sum(a) / a.length; }// w w w . j a v a 2 s. co m public static double sum(double[] a) { double s = 0.0; for (double v : a) { s += v; } return s; } }