Java examples for java.lang:Math Algorithm
average a double type array
//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];/*from w w w . j ava 2 s . co m*/ } return sum / a.length; } }