Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int N = 1234 - 16*16 * 2;
- int Base = 16;
- String result = "";
- while (N > 0) {
- result += (char)(N % Base);
- N /= Base;
- }
- boolean isPalindrome = true;
- int strLen = result.length();
- for (int i = 0; i < strLen/2; i ++) {
- if (result.charAt(i) != result.charAt(strLen - i - 1)) {
- isPalindrome = false;
- break;
- }
- }
- // abcba
- // a'''a
- // 'b'b'
- // 2 13 2 (2D2) is palindrome
- System.out.println(isPalindrome);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement