Finding index of first substring
Just checking that you intend to be reinventing-the-wheel, you can do:

System.out.println("happy".indexOf("app"));


You did know that, right?

Or, if you want to reformat the 'signature' to match yours, it is:

public static int subStringIndex(String str, String substr) {
    return str.indexOf(substr);
}


There are a number of helper methods on String which will help:


String.indexOf(substr) - return the index of the first occurrence of substr
String.indexOf(substr, start) - return the index of the first occurrence of substr on or after the start position.
String.lastIndexOf(substr) - return the index of the last occurrence of substr
String.lastIndexOf(substr, start) - return the index of the last occurrence of substr starting before the start position.
 -