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