Last occurrence of a substring
public class Main { public static void main(String[] argv) throws Exception { String string = "I am Java"; int index = string.lastIndexOf("am"); } }