Java program to check if a given string is a palindrome or not