@Test public void testSum() { double expResult = 55.0d; double result = SampleStats.sum(values, true); assertEquals(expResult, result, TOL); }
public static double sum(Double[] values, boolean ignoreNaN) { double sum = 0.0d; for (int i = 0; i < values.length; i++) { if (Double.isNaN(values[i])) { if (!ignoreNaN) { return Double.NaN; } } else { sum = sum + values[i]; } } return sum; }
SampleStats { public static double sum(Double[] values, boolean ignoreNaN) { double sum = 0.0d; for (int i = 0; i < values.length; i++) { if (Double.isNaN(values[i])) { if (!ignoreNaN) { return Double.NaN; } } else { sum = sum + values[i]; } } return sum; } }
SampleStats { public static double sum(Double[] values, boolean ignoreNaN) { double sum = 0.0d; for (int i = 0; i < values.length; i++) { if (Double.isNaN(values[i])) { if (!ignoreNaN) { return Double.NaN; } } else { sum = sum + values[i]; } } return sum; }  }
SampleStats { public static double sum(Double[] values, boolean ignoreNaN) { double sum = 0.0d; for (int i = 0; i < values.length; i++) { if (Double.isNaN(values[i])) { if (!ignoreNaN) { return Double.NaN; } } else { sum = sum + values[i]; } } return sum; }  static double max(Double[] values, boolean ignoreNaN); static double mean(Double[] values, boolean ignoreNaN); static double min(Double[] values, boolean ignoreNaN); @SuppressWarnings("empty-statement") static double median(Double[] values, boolean ignoreNaN); @SuppressWarnings("empty-statement") static double mode(Double[] values, boolean ignoreNaN); static double range(Double[] values, boolean ignoreNaN); static double variance(Double[] values, boolean ignoreNaN); static double sdev(Double[] values, boolean ignoreNaN); static double sum(Double[] values, boolean ignoreNaN); }
SampleStats { public static double sum(Double[] values, boolean ignoreNaN) { double sum = 0.0d; for (int i = 0; i < values.length; i++) { if (Double.isNaN(values[i])) { if (!ignoreNaN) { return Double.NaN; } } else { sum = sum + values[i]; } } return sum; }  static double max(Double[] values, boolean ignoreNaN); static double mean(Double[] values, boolean ignoreNaN); static double min(Double[] values, boolean ignoreNaN); @SuppressWarnings("empty-statement") static double median(Double[] values, boolean ignoreNaN); @SuppressWarnings("empty-statement") static double mode(Double[] values, boolean ignoreNaN); static double range(Double[] values, boolean ignoreNaN); static double variance(Double[] values, boolean ignoreNaN); static double sdev(Double[] values, boolean ignoreNaN); static double sum(Double[] values, boolean ignoreNaN);  }