Here you can find the source of mean(double[] array)
public static double mean(double[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static double mean(double[] array) { if (array.length == 0) throw new IllegalArgumentException("length cannot be 0."); double sum = 0; for (double d : array) { sum += d;//from w w w . j a v a 2 s. c o m } return sum / array.length; } }