Simple palindrome example written in Java