Display an integer reversed

The problem

Write a method with the following header to display an integer in reverse order. For example, reverse(3456) displays 6543. Write a test program that prompts the user to enter an integer and displays its reversal.

Breaking it down

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    System.out.print("Enter a integer: ");
    int num = input.nextInt();

    input.close();

    StringBuffer sb = new StringBuffer(String.valueOf(num));

    System.out.println("Integer reversed is " + sb.reverse());
}

Output

Enter a integer: 234233
Integer reversed is 332432