Reverse a number in JAVA??

Hello
i need help with how to write a method that displays numbers in reverse form in java. thanks

Posted Answers

Hi
Reversing a number can be done in the following steps
1) write a method that takes an int value as parameter
2) convert that int value into String using Integer.toString()
3) Now make this string a StringBuffer and use reverse() of StringBuffer to reverse the number and parse it to Int
and you are done..
You can also read solutions for other programming related problems visit:
http://www.coders2020.com/java-interview-questions


Answer by: indi.anupam