Here you can find the source of mean(Double[] a)
public static Double mean(Double[] a)
//package com.java2s; //License from project: Open Source License public class Main { public static Double mean(Double[] a) { if (a.length == 0) { throw new IllegalArgumentException("The entered array is empty."); }//from w ww.j a va 2s . co m Double sum = 0.0; for (int n = 0; n < a.length; n++) { sum += a[n]; } return sum / a.length; } public static double mean(double[] a) { if (a.length == 0) { throw new IllegalArgumentException("The entered array is empty."); } double sum = 0.0; for (int n = 0; n < a.length; n++) { sum += a[n]; } return sum / a.length; } public static Double mean(Integer[] a) { if (a.length == 0) { throw new IllegalArgumentException("The entered array is empty."); } Double[] a_d = new Double[a.length]; for (int n = 0; n < a_d.length; n++) { a_d[n] = Double.valueOf(a[n]); } return mean(a_d); } public static double mean(int[] a) { if (a.length == 0) { throw new IllegalArgumentException("The entered array is empty."); } double[] a_d = new double[a.length]; for (int n = 0; n < a_d.length; n++) { a_d[n] = a[n]; } return mean(a_d); } }