Here you can find the source of mean(float[] xs)
public static float mean(float[] xs)
//package com.java2s; //License from project: Apache License public class Main { public static float mean(float[] xs) { if (xs == null || xs.length == 0) throw new IllegalArgumentException("Input to mean() is an empty array"); float sum = 0.0f; for (int i = 0; i < xs.length; ++i) sum += xs[i];//w w w. j ava2 s. c o m return sum / (float) xs.length; } public static float mean(float x, float y) { return (x + y) * 0.5f; } }