I think what you're trying to do is this?
public boolean isPalindrome(String s) {
for (int i = 0; i < s.length() / 2; i++) {
if (s.charAt(i) != s.charAt(s.length() - i - 1)) {
return false;
}
}
return true;
}
You can reverse strings using StringBuilder, so this could be more easy written as
public boolean isPalindrome(String s) {
return new StringBuilder(s).reverse().toString().equals(s);
}