Here you can find the source of average(Double[] arr)
public static Double average(Double[] arr)
//package com.java2s; //License from project: Open Source License public class Main { public static Double average(Double[] arr) { return sum(arr) / arr.length; }// w w w .ja va 2s .c om public static double sum(double[] arr) { double sum = 0; for (int i = 0; i < arr.length; i++) sum += arr[i]; return sum; } public static double sum(Double[] arr) { double sum = 0; for (int i = 0; i < arr.length; i++) sum += arr[i]; return sum; } public static int sum(int[] arr) { int sum = 0; for (int i = 0; i < arr.length; i++) sum += arr[i]; return sum; } public static int sum(Integer[] arr) { int sum = 0; for (int i = 0; i < arr.length; i++) sum += arr[i]; return sum; } }