Here you can find the source of getMean(Collection
public static double[] getMean(Collection<double[]> cluster)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static double[] getMean(Collection<double[]> cluster) { int l = cluster.iterator().next().length; double[] r = new double[l]; for (double[] d : cluster) for (int i = 0; i < l; i++) r[i] += d[i];/*from www .j av a2 s . c o m*/ for (int i = 0; i < l; i++) r[i] /= cluster.size(); return r; } }