question: 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 ; }
target:  Returns the number of times the token appears in the target.