Function to check if the number N is palindrome
public static boolean ispalindrome ( int n ) { String temp = Integer . toString ( n ) ; int l = temp . length ( ) ; for ( int i = 0 ; i < l / 2 ; i ++ ) { if ( temp . charAt ( i ) != temp . charAt ( l - i - 1 ) ) return false ; } return true ; }