Python Recursive Function For Palindrome In Java