Get substring from StringBuffer - Java Quiz Question

Write a program to get the substring from the given StringBuffer according to the given index.
For more clarification see the requirements.

Input (StringBuffer, int) Output (String)
'HelloWorld', 5 'World'
'JavaSchool', 6 'hool'
'Mathematics', 7 'tics'
'Concentrate', 0 'Concentrate'

class GetSubStringFromStringBufferWithOnlyStartIndex
    public static void main(String s[])
        System.out.println("The resultant substring is : " + getSubString(new StringBuffer("HelloWorld"), 5));


    public static String getSubString(StringBuffer stringBuffer, int startIndex) {