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;

```

}
Why dont you think simple. Precisely, mirror image of the chars would be same and if it is not it is not palindrome. When you cross middle of the array without finding a difference it is an absolute palindrome. Check this out.

```
int len = str.getLenght();
int i = 0;

do {
    if (str.get(i) == str.get(len-1-i))
        i++;
    else {
        print("NOT a palindrome");
        break;
    }

} while (i < len-1-i) ;

if (i < len-1-i)  print("NOT a palindrome");    

```