// Summary: Palindromes program.// Sorry for the messy code, wanted to do this all in a single method.// I could probably make this into a method that just accepts a string and returns a boolean.import java.lang.reflect.*;public class Testpal{ public static void main(String[] args){ String testing = "Campus Motto: Bottos up, Mac"; // Put string to be tested here. // Now we read the string into an array, excluding any punctuation, and converting it all to lowercase. char isitletter = ' '; int testinglength = testing.length(); char[] testarray = new char[testinglength]; int arrayposition = 1; int blankspots = 0; for(short x=0; x<testinglength; x++){ System.out.print("Character Index: " + x); isitletter = testing.charAt(x); System.out.println(" " + isitletter); boolean letter = Character.isLetter(isitletter); boolean lower = Character.isLowerCase(isitletter); System.out.println("IsLetter? " + letter + " Lowercase? " + lower); if(letter == true){ if(lower == false){ isitletter = Character.toLowerCase(isitletter); System.out.println("arraypos " + arrayposition); Array.set(testarray, arrayposition, isitletter); arrayposition++; } else{ System.out.println("else" + arrayposition); Array.set(testarray, arrayposition, isitletter); arrayposition++; } } else{blankspots++;} } // Now to check for palindromes. int first = 0; int last = Array.getLength(testarray) - blankspots; System.out.println("Array Length = " + last); int middleofarray = last/2; char test1 = ' '; char test2 = ' '; int verdict = 0; for(short i=1; i<=middleofarray; i++){ test1 = Array.getChar(testarray, i); test2 = Array.getChar(testarray, last); System.out.println(test1 + " " + test2); // Check whether chars are same if(test1 == test2){System.out.println(test1 + " " + test2 + " Maybe....");} else{verdict = 1;break;} last = last - 1; } if (verdict == 1){System.out.println(testing + " is NOT a Palindrome.");} else {System.out.println(testing + " IS a Palindrome.");} }}