Skip to content

Instantly share code, notes, and snippets.

@SIRHAMY
Created December 15, 2015 05:08
Show Gist options
  • Save SIRHAMY/723ba939652abba2d53d to your computer and use it in GitHub Desktop.
Save SIRHAMY/723ba939652abba2d53d to your computer and use it in GitHub Desktop.
Java: Decides if given string is a Palindrome
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment