int left = 0;
int right = str.length()-1;
while(left < right){
char ch1 = str.charAt(left);
char ch2 = str.charAt(right);
if(ch1 == ch2){
left++;
right--;
} else{
return false;
}
}
return true;