### Question:
DataUtilities { public static double calculateRowTotal(Values2D data, int row) { if (data == null) { throw new IllegalArgumentException("Null 'data' argument."); } double total = 0.0; int columnCount = data.getColumnCount(); for (int c = 0; c < columnCount; c++) { Number n = data.getValue(row, c); if (n != null) { total += n.doubleValue(); } } return total; }  static boolean equal(double[][] a, double[][] b); static double[][] clone(double[][] source); static double calculateColumnTotal(Values2D data, int column); static double calculateColumnTotal(Values2D data, int column,
             int[] validRows); static double calculateRowTotal(Values2D data, int row); static double calculateRowTotal(Values2D data, int row,
             int[] validCols); static Number[] createNumberArray(double[] data); static Number[][] createNumberArray2D(double[][] data); static KeyedValues getCumulativePercentages(KeyedValues data);  }### Answer:
@Test public void testCalculateRowTotal() { DefaultKeyedValues2D table = new DefaultKeyedValues2D(); table.addValue(1.0, "R0", "C0"); table.addValue(2.0, "R0", "C1"); table.addValue(3.0, "R1", "C0"); table.addValue(4.0, "R1", "C1"); assertEquals(3.0, DataUtilities.calculateRowTotal(table, 0), EPSILON); assertEquals(7.0, DataUtilities.calculateRowTotal(table, 1), EPSILON); table.setValue(null, "R1", "C1"); assertEquals(3.0, DataUtilities.calculateRowTotal(table, 1), EPSILON); }
@Test public void testCalculateRowTotal2() { DefaultKeyedValues2D table = new DefaultKeyedValues2D(); table.addValue(1.0, "R0", "C0"); table.addValue(2.0, "R0", "C1"); table.addValue(3.0, "R1", "C0"); table.addValue(4.0, "R1", "C1"); assertEquals(3.0, DataUtilities.calculateRowTotal(table, 0, new int[] {0, 1}), EPSILON); assertEquals(1.0, DataUtilities.calculateRowTotal(table, 0, new int[] {0}), EPSILON); assertEquals(2.0, DataUtilities.calculateRowTotal(table, 0, new int[] {1}), EPSILON); assertEquals(0.0, DataUtilities.calculateRowTotal(table, 0, new int[] {}), EPSILON); assertEquals(7.0, DataUtilities.calculateRowTotal(table, 1, new int[] {0, 1}), EPSILON); assertEquals(3.0, DataUtilities.calculateRowTotal(table, 1, new int[] {0}), EPSILON); assertEquals(4.0, DataUtilities.calculateRowTotal(table, 1, new int[] {1}), EPSILON); assertEquals(0.0, DataUtilities.calculateRowTotal(table, 1, new int[] {}), EPSILON); table.setValue(null, "R1", "C1"); assertEquals(3.0, DataUtilities.calculateRowTotal(table, 1, new int[] {0, 1}), EPSILON); assertEquals(0.0, DataUtilities.calculateRowTotal(table, 1, new int[] {1}), EPSILON); }