Here you can find the source of countCharacterOccurrences(String string, char c)
private static Object countCharacterOccurrences(String string, char c)
//package com.java2s; //License from project: Open Source License public class Main { private static Object countCharacterOccurrences(String string, char c) { int result = 0; int length = string.length(); for (int i = 0; i < length; i++) { if (string.charAt(i) == c) { result++;// w w w. ja v a2s . co m } } return result; } }