added java code to check if palindrome using stacks