Java course work beginner's leve,Help

Hi Friends,

This is my first time posting in this form and first time posting with regards to Java.I am new learner of Java.And I need help please.

Write a JAVA program that asks for a number (for instance 154).The program

has to display the digits of the number in reverse order.

for instance: 451

I hope you got the question,another example is suppose I entered 234 as the input on the program.The program has to display 432.

The program below should give u clues.I tried many times but I was unsuccessful.

/*

* File: DigitSum.java

* -------------------

* This program sums the digits in a positive integer.

* The program depends on the fact that the last digit of

* a integer n is given by n % 10 and the number consisting

* of all but the last digit is given by the expression n / 10.

*/

import acm.program.*;

public class DigitSum extends ConsoleProgram {

public void run() {

println("This program sums the digits in an integer.");

int n = readInt("Enter a positive integer: ");

int dsum = 0;

while (n > 0) {

dsum += n % 10;

n /= 10;

}

println("The sum of the digits is " + dsum);

}

}

Thank you in advance.