SHARE
TWEET

Untitled

a guest Dec 8th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             int N = 1234 - 16*16 * 2;
  2.             int Base = 16;
  3.             String result = "";
  4.  
  5.             while (N > 0) {
  6.                 result += (char)(N % Base);
  7.                 N /= Base;
  8.             }
  9.  
  10.             boolean isPalindrome = true;
  11.             int strLen = result.length();
  12.  
  13.             for (int i = 0; i < strLen/2; i ++) {
  14.                 if (result.charAt(i) != result.charAt(strLen - i - 1)) {
  15.                     isPalindrome = false;
  16.                     break;
  17.                 }
  18.             }
  19.             // abcba
  20.             // a'''a
  21.             // 'b'b'
  22.             // 2 13 2 (2D2) is palindrome
  23.             System.out.println(isPalindrome);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top