Utils { public static double stdev(double[] a) { double m = mean(a); double sumsq = 0; for (double v : a) sumsq += (v-m)*(v-m); return Math.sqrt(sumsq / a.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 testStdev() { assertThat(Utils.stdev(new double[]{10,12,14,18}), is(Math.sqrt(8.75))); }
@Test public void testStdev_empty() { assertThat(Utils.stdev(new double[]{}), is(NaN)); }
@Test public void testStdev_singleNumber() { assertThat(Utils.stdev(new double[]{42}), is(0d)); }
@Test public void testStdev_manyNumbers() { assertThat(Utils.stdev(new double[]{-1,0,1}), is(Math.sqrt(2d/3d))); }