    public static int countOccurrences(String str, char ch) {
	int count = 0;
	int pos = str.indexOf(ch);
	while (pos != -1) {
	    count++;
	    pos = str.indexOf(ch, pos + 1);
	}
	return count;
    }
