1
JavaBeginner#strings
Compare the string to its reverse, or use two pointers moving from both ends toward the middle, checking character equality at each step.
boolean isPalindrome(String s) {
int i = 0, j = s.length() - 1;
while (i < j) { if (s.charAt(i++) != s.charAt(j--)) return false; }
return true;
}
isPalindrome("madam"); // true