Cognizant interview question

Was asked to write a java code to check Palindrome