Here you can find the source of countOccurence(String matchedString, char occurence)
public static int countOccurence(String matchedString, char occurence)
//package com.java2s; //License from project: Apache License public class Main { public static int countOccurence(String matchedString, char occurence) { int count = 0; for (final char c : matchedString.toCharArray()) { if (c == occurence) { ++count;/*from w w w . ja v a2 s . co m*/ } } return count; } }