Why is the following algorithm not halting for me? (str is the string I am searching in, findStr is the string I am trying to find)
String str = \"helloslkhe
public int countOfOccurrences(String str, String subStr) { return (str.length() - str.replaceAll(Pattern.quote(subStr), "").length()) / subStr.length(); }