protected int countToken(String token,String target){
  int tokenIndex=0;
  int count=0;
  while (tokenIndex != -1) {
    tokenIndex=target.indexOf(token,tokenIndex);
    if (tokenIndex > -1) {
      tokenIndex++;
      count++;
    }
  }
  return count;
}

protected int countToken ( String token , String target ) { int tokenIndex = 0 ; int count = 0 ; while ( tokenIndex != - 1 ) { tokenIndex = target . indexOf ( token , tokenIndex ) ; if ( tokenIndex > - 1 ) { tokenIndex ++ ; count ++ ; } } return count ; }
returns the number of times the token appears in the target .
