Java programming

How can we reverse a number? Example the given number is 300. What method is used to make that number be reversed?

u can make its code. its so simple

int num=123;
int finalNum=0;

while(num>0){
int qt=num%10;
num=num/10;
finalNum=finalNum*10 + qt;
}

after completing loop, ur final value will be it’s reverse i.e. finalNum will be 321