Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean isPalindrome(int num) {
- if (num < 0) return false;
- String stringNum = String.valueOf(num);
- for (int i = 0; i < stringNum.length() / 2 + 1; i++) {
- if (stringNum.charAt(i) != stringNum.charAt(stringNum.length() - i - 1)) return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement