Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean isPal(String string) {
- String toCompare = new String();
- for (int i = string.length(); i>0; i--) {
- toCompare = toCompare.concat(Character.toString(string.charAt(i-1)));
- }
- if (string.equals(toCompare)) {
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment