public static double calculateRowTotal(Values2D data,int row,int[] validCols){
  ParamChecks.nullNotPermitted(data,"data");
  double total=0.0;
  int colCount=data.getColumnCount();
  for (int v=0; v < validCols.length; v++) {
    int col=validCols[v];
    if (col < colCount) {
      Number n=data.getValue(row,col);
      if (n != null) {
        total+=n.doubleValue();
      }
    }
  }
  return total;
}

public static double calculateRowTotal ( Values2D data , int row , int [ ] validCols ) { ParamChecks . nullNotPermitted ( data , "data" ) ; double total = 0.0 ; int colCount = data . getColumnCount ( ) ; for ( int v = 0 ; v < validCols . length ; v ++ ) { int col = validCols [ v ] ; if ( col < colCount ) { Number n = data . getValue ( row , col ) ; if ( n != null ) { total += n . doubleValue ( ) ; } } } return total ; }
returns the total of the values in one row of the supplied data table by taking only the column numbers in the array into account .
