LTM Limited interview question

Palindrome code in java or c++