count characters occurrence in string java