SHARE
TWEET

Simple palindrome method

Nickster258 Sep 20th, 2016 (edited) 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static boolean isPal(String string) {
  2.     String toCompare = new String();
  3.     for (int i = string.length(); i>0; i--) {
  4.         toCompare = toCompare.concat(Character.toString(string.charAt(i-1)));
  5.     }
  6.     if (string.equals(toCompare)) {
  7.         return true;
  8.     }
  9.     return false;
  10. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top