import java.util.Scanner;

public class ReverseNumber {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println(“Enter a number which you want to reverse: “);
        int a = in.nextInt(), r=0, s=0, p=a;
        
        while(p!=0){
            r = p%10;
            p = p/10;
            s = s*10 + r;
        }
        if(s==a){
            System.out.println(“number entered by user “+a+” is a palindrome.”);
        }else
            System.out.println(“number entered by user “+a+” is not a palindrome.”);
    }
}

 

Source: http://selenium-makeiteasy.blogspot.com