Spellmaster DuskShadow
2013-06-08 12:05:03 UTC
Here's what I have:
import java.util.Scanner;
public class PalindromeInteger {
public static int reverse(int number) {
int temp = 0;
temp = temp * 10;
temp = temp + number % 10;
number = number / 10;
return temp;
}
public static boolean isPalindrome(int number) {
int reversed = reverse(number);
if (reversed != number)
return false;
else
return true;
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a int ");
int number = input.nextInt();
boolean Palindrome = isPalindrome(number);
if (Palindrome = true)
System.out.println("Is a palindrome");
else
System.out.println("Is not a palindrome");
}
}
It ALWAYS says it is not a palindrome. What am I doing wrong? Thanks
Feel free to be rude or condescending, as long as you actually help. I don't want you to code it, i want to know what I'm doing wrong.