[java] Printing reverse of any String without using any predefined function?

private void rev() {
    String st="hello";
    String b="";

    for(int i=st.length()-1;i>=0;i--){
        b=b+st.charAt(i);
    }

    System.out.println("reverse:::"+b);
}