
public class PalindromeExercise {

	public static void main(String[] args) {
		System.out.println(stripBlanks("This This").equals("thisthis"));
		System.out.println(reversed("This This").equals("sihT sihT"));
		System.out.println(isPalindrome("racecar") == true);
		System.out.println(isPalindrome("Was it a CAR or a CAT I saw") == true);
	}

	private static String stripBlanks(String phrase) {
		String preppedString = "";
		// read the string 
		for (int i=0; i < phrase.length(); i++) {
			// If the character is not blank, add it to preppedString
			if (phrase.charAt(i) != ' ') {
				preppedString = preppedString + phrase.charAt(i);
			}
		}
		return preppedString.toLowerCase();
	}

	private static Object reversed(String string) {
		// TODO Auto-generated method stub
		return null;
	}

	private static boolean isPalindrome(String phrase) {
		// strip spaces and capitalization from phrase
		String testPhrase = stripBlanks(phrase);
		// compare phrase to reversed phrase
		return testPhrase.equals(reversed(testPhrase));
	}

	private static String prepareString(String phrase) {
		String preppedString = "";
		// read the string end to beginning
		for (int i=phrase.length() - 1; i >= 0; i--) {
			// If the character is not blank, add it to preppedString
			if (phrase.charAt(i) != ' ') {
				preppedString = preppedString + phrase.charAt(i);
			}
		}
		return preppedString.toLowerCase();
	}

	
}

@@ -333,16 +333,69 @@
  true);%0A
+%09%09System.out.println(isPalindrome(%22Java%22) == false);%0A
 %09%7D%0A%0A%09pri
@@ -757,14 +757,14 @@
 tic 
-Object
+String
  rev
@@ -780,54 +780,202 @@
 ing 
-string
+phrase) %7B%0A%09%09String newString = %22%22;%0A%09%09for (int i=phrase.length() - 1; i %3E= 0; i--
 ) %7B%0A
+%09
 %09%09// 
-TODO Auto-gene
+If the cha
 ra
+c
 te
-d method stub
+r is not blank, add it to preppedString%0A%09%09%09%09newString = newString + phrase.charAt(i);%0A%09%09%7D
 %0A%09%09r
@@ -985,11 +985,16 @@
 rn n
-ull
+ewString
 ;%0A%09%7D
@@ -1237,379 +1237,8 @@
 %0A%09%7D%0A
-%0A%09private static String prepareString(String phrase) %7B%0A%09%09String preppedString = %22%22;%0A%09%09// read the string end to beginning%0A%09%09for (int i=phrase.length() - 1; i %3E= 0; i--) %7B%0A%09%09%09// If the character is not blank, add it to preppedString%0A%09%09%09if (phrase.charAt(i) != ' ') %7B%0A%09%09%09%09preppedString = preppedString + phrase.charAt(i);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return preppedString.toLowerCase();%0A%09%7D%0A%0A
 %09%0A%7D%0A

Complete Palindrome example