howdee there, i'm a rookie and stuck on a problem. I need to write a program without the use of strings or arrays that works out if a number is a palindrome or not. I've got the number to reverse by % and / but need to reconstruct it so I can compare the two numbers, what i've been trying to do is to find the number of digits in the number and using a loop multiply the corresponding digits by the appropriate number, ie 10,100,1000 etc. Any help would be great. billo 'darn tootin' bailey
Billo, not sure if I have this straight, you have the two ints but you want to convert the new value back to the original to compare them ?? Why not just create 2 new Integer objects and use the int compareTo(Integer anotherInteger) method to do the compare for you?
posted 16 years ago
Sure, objects are nice, but a simple a == btest would likely suffice.