Here you can find the source of mean(final double[] expected, final int begin, final int end)
public static double mean(final double[] expected, final int begin, final int end)
//package com.java2s; /**//from w w w . ja v a2s .c o m * Copyright? 2014-2016 LIST (Luxembourg Institute of Science and Technology), all right reserved. * Authorship : Olivier PARISOT, Yoanne DIDRY * Licensed under GNU General Public License version 3 */ public class Main { public static double mean(final double[] expected, final int begin, final int end) { int trueN = 0; double mean = 0d; for (int i = Math.max(0, begin); i < Math.min(expected.length - 1, end); i++) { mean += expected[i]; trueN++; } if (trueN == 0) throw new IllegalStateException(); mean /= (double) trueN; return mean; } }