Utils { public static double mean(double[] x) { double s = 0; for (double v: x) s += v; return s / x.length; }  static double median(ArrayList<Double> arrList); static double mean(double[] x); static double[] interp(double[] x, double[] xp, double[] yp); static double stdev(double[] a); static double[] extract(int[] indicator, int value, double[] arr); static String array2string(double[] a, String format); static int argmax(double[] a); static int argmin(double[] a); static double findBestShift(double[] laserT, double[] touchT, double[] touchY);  }
@Test public void testMeanEntries() { List<Entry> entries = new ArrayList<>(); for (int i = 1; i <= 10; i++) { entries.add(new Entry(i, i)); } assertEquals(5.5, Utils.mean(entries), 1e-12); }
@Test public void testMean() { assertThat(Utils.mean(new double[]{-1,1,2,3}), is(1.25d)); }
@Test public void testMean_singleNumber() { assertThat(Utils.mean(new double[]{0}), is(0d)); }
@Test public void testMean_empty() { assertThat(Utils.mean(new double[]{}), is(NaN)); }
@Test public void testMean_repeatedNumbers() { assertThat(Utils.mean(new double[]{5,5,5,5}), is(5d)); }