Here you can find the source of average(double[] a)
public static double average(double[] a)
//package com.java2s; public class Main { public static double average(double[] a) { double sum = 0; for (int i = 0; i < a.length; i++) { sum += a[i];/*ww w. j a v a2 s . c om*/ } return sum / a.length; } }