Write a java program to reverse a number

Let us suppose that a number is 12345 and we want to reverse this number like 54321 so here is a java program which reverse your any number given by you.


public class reverseNumber
{
public static void main(String as[])
{
System.out.println("Please Enter your Number want to reverse
int n=Integer.parseInt(as[0]);
int m=0;
int r=0;
while(n!=0)
{
r=n%10;
m=m*10+r;
n=n/10;
}
System.out.println("Reverse number:----"+m);
}
}