Question: Currently incredibly confused about how I would go about moving the logic for determining if a string is a palindrome from the main method into a method named checkPalindrome? My method should have a single String argument and return a boolean value, but I'm still unsure of how to do this.

```
import java.util.Scanner;

public class PalindromeCheckMethod {

public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter a String: ");
        String s = input.nextLine();
        boolean isPalindrome = checkPalindrome(s);
        String msg = "not a palindrome";
        if (isPalindrome) {
            msg = "a palindrome";
        }
        System.out.printf("%s is %s.%n", s, msg);

        s = s.toLowerCase();
        String resultString = "";

        for (int i = 0; i < s.length(); i++) {
            if (Character.isLetter(s.charAt(i)))
                resultString += s.charAt(i);
        }
        s = resultString;

        int low = 0;
        int high = s.length() - 1;

        if (high >= 0)  {

        while (low < high) {
            if (s.charAt(low) != s.charAt(high)) {
                isPalindrome = false;
                break;
            }
                low++;
                high--;
            }
        }
        else {
            isPalindrome = false;
        }

        if (isPalindrome)
            System.out.println(s + " is a palindrome. ");
        else 
            System.out.println(s + " is not a palindrome. ");

        }

private static boolean checkPalindrome(String s) {
    return false;
}

    }

```

Answer: 
```
static boolean checkPalindrome(String str) 
{
   int strEndPoint=str.length()-1;
   int strStartPoint=0;
   boolean isPalindrome=true;
   while(strStartPoint<=strEndPoint)
   {
       if(str.charAt(strStartPoint)!=str.charAt(strEndPoint))
       {
          isPalindrome=false;
          break;
       }
     strStartPoint++;
     strEndPoint--;
  }
 return isPalindrome;

```

}
Well, I would use a [`StringBuilder`](http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html) and implement a method of that description with something like,

```
static boolean checkPalindrome(final String s) {
    StringBuilder sb = new StringBuilder(s);
    sb.reverse();
    return sb.toString().equalsIgnoreCase(s);
}

```

But you could certainly replace my implementation with your implementation (I did not validate your implementation). To call the method (and perhaps take advantage of formatted io) you could use something like 

```
public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    System.out.println("Enter a String: ");
    String s = input.nextLine();
    boolean isPalindrome = checkPalindrome(s);
    String msg = "not a palindrome";
    if (isPalindrome) {
        msg = "a palindrome";
    }
    System.out.printf("%s is %s.%n", s, msg);
}

```