Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static int getCharOccurance(String input, char c) { int occurance = 0; char[] chars = input.toCharArray(); for (char thisChar : chars) { if (thisChar == c) { occurance++; } } return occurance; } }