private static boolean isForStatement(String line,int offset){
  int forPos=line.indexOf("for");
  if (forPos != -1) {
    if ((forPos == 0 || !Character.isJavaIdentifierPart(line.charAt(forPos - 1))) && (line.length() == forPos + 3 || !Character.isJavaIdentifierPart(line.charAt(forPos + 3))))     return true;
  }
  return false;
}

private static boolean isForStatement ( String line , int offset ) { int forPos = line . indexOf ( "for" ) ; if ( forPos != - 1 ) { if ( ( forPos == 0 || ! Character . isJavaIdentifierPart ( line . charAt ( forPos - 1 ) ) ) && ( line . length ( ) == forPos + 3 || ! Character . isJavaIdentifierPart ( line . charAt ( forPos + 3 ) ) ) ) return true ; } return false ; }
determines whether the current line contains a for statement . algorithm : any " for " word in the line is a positive , " for " contained in a string literal will produce a false positive .
