public static String trimLine(String line){
  int idx=line.indexOf("//");
  if (idx != -1) {
    line=line.substring(0,idx);
  }
  return line.trim();
}

public static String trimLine ( String line ) { int idx = line . indexOf ( "//" ) ; if ( idx != - 1 ) { line = line . substring ( 0 , idx ) ; } return line . trim ( ) ; }
trims a line and removes comments
