Here you can find the source of countCharacters(String code, char c, int start, int end)
public static int countCharacters(String code, char c, int start, int end)
//package com.java2s; //License from project: Open Source License public class Main { public static int countCharacters(String code, char c, int start, int end) { int count = 0; for (int i = start; i < end; i++) { if (code.charAt(i) == c) { count++;/*from www . j a v a2s . c o m*/ } } return count; } }