結果 : java function to count occurrences of char in string