Jak sprawdzić, ile jednej postaci jest w Java String

int count = string.length() - string.replaceAll("g","").length()
Obedient Ox