Java program to check whether string is palindrome