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
Increment lastIndex whenever you look for next occurrence.
lastIndex
Otherwise it's always finding the first substring (at position 0).