Here you can find the source of Mean(Object in)
public static final double Mean(Object in)
//package com.java2s; //License from project: Open Source License public class Main { public static final double Mean(Object in) { return ((double) Sum(in) / (double) NElem(in)); }// www.j a v a 2s .c o m public static final double Mean(Object in, int i1, int i2) { return ((double) Sum(in, i1, i2) / (double) (i2 - i1 + 1)); } public static final int Sum(Object in, int min, int max) { if (in == null) return 0; // END NO BOOL /* BOOL ONLY public static final int Sum( Object in, int min, int max ) { // END BOOL ONLY */ if (in instanceof int[]) { int[] inn = (int[]) in; if (max >= inn.length) max = inn.length - 1; // NO BOOL int out = 0; for (int i = min; i <= max; i++) out += inn[i]; return out; // END NO BOOL /* BOOL ONLY int out = 0; for ( int i = min; i <= max; i ++ ) out += inn[ i ] ? 1 : 0; return out; // END BOOL ONLY */ } else { // NO BOOL int out = 0; // END NO BOOL /* BOOL ONLY int out = 0; // END BOOL ONLY */ for (int i = 0, s = ((Object[]) in).length; i < s; i++) out += Sum(((Object[]) in)[i], min, max); return out; } } public static final int Sum(Object in) { // END NO BOOL /* BOOL ONLY public static final int Sum( Object in ) { // END BOOL ONLY */ if (in instanceof int[]) return Sum((int[]) in, 0, ((int[]) in).length); else { // NO BOOL int out = 0; // END NO BOOL /* BOOL ONLY int out = 0; // END BOOL ONLY */ for (int i = 0, s = ((Object[]) in).length; i < s; i++) out += Sum(((Object[]) in)[i]); return out; } } public static final int NElem(Object in) { if (in instanceof int[]) return ((int[]) in).length; else { int sum = 0; for (int i = 0, s = ((Object[]) in).length; i < s; i++) sum += NElem(((Object[]) in)[i]); return sum; } } }