Get last index of given substring - Java Quiz Question

Write a program to get the last index of substring from the StringBuffer object.If match is not found then returns -1.
For more clarification see the requirements.

Input (StringBuffer, String) Output (int)
'HelloWorld', 'World' 5
'JavaSchool', 'Java' 0
'Mathematics', 't' 7
'Computer', 'n' -1

class GetLastIndexOfGivenSubString
    public static void main(String s[])
        System.out.println("Index of given substring is: " + getLastIndexOfSubString(new StringBuffer("HelloWorld"), "World"));


    public static int getLastIndexOfSubString(StringBuffer stringBuffer, String subString) {