reversing integer in java code example
Example 1: reverse a integer in java
while(num != 0)
{
int digit = num % 10;
reversed = reversed * 10 + digit;
num /= 10;
}
Example 2: how to reverse a number in java
int rev= 0;
while(num > 9)
{
rev= rev*10 + num%10;
num/= 10;
}