public int countTokens(){
  int count=0;
  boolean inToken=false;
  for (int i=position, length=string.length(); i < length; i++) {
    if (delimiters.indexOf(string.charAt(i),0) >= 0) {
      if (returnDelimiters)       count++;
      if (inToken) {
        count++;
        inToken=false;
      }
    }
 else {
      inToken=true;
    }
  }
  if (inToken)   count++;
  return count;
}

public int countTokens ( ) { int count = 0 ; boolean inToken = false ; for ( int i = position , length = string . length ( ) ; i < length ; i ++ ) { if ( delimiters . indexOf ( string . charAt ( i ) , 0 ) >= 0 ) { if ( returnDelimiters ) count ++ ; if ( inToken ) { count ++ ; inToken = false ; } } else { inToken = true ; } } if ( inToken ) count ++ ; return count ; }
returns the number of unprocessed tokens remaining in the string .
