title: Palindrome program debugging
body: <p>The problem is fixed but I need help with creating a method for one of the pieces of code. Any inputs will be appreciated. I tried using void methods but it didn't work. I have highlighted where i want the code to be a method.</p>
  
  <pre><code>import java.util.*;
   public class Finalpal {
  
  public Finalpal() {
      // TODO Auto-generated constructor stub
  }
  
  public static void main(String[] args) 
  {
  Scanner scan = new Scanner(System.in);
  
      String word;
      int len, counter = 0;
  
      System.out.println("Enter your word");
      word = scan.next();
  
      word = word.toUpperCase();
  
      len = word.length();
  
      char array[] = new char[len];
      char reverse[] = new char[len];
  
      for (int i=0; i &lt; len; i++)
      {
          array[i] = word.charAt(i);
      }
      for (int j=len-1; j&gt;=0; j--)
      {
          array[counter] = word.charAt(j);
          counter++;
  
      }
  
      // This part needs to be a method
      for (int k = 0; k &lt; len; k++)
      {
          if (array[k] != reverse[k])
          {
              System.out.println("Not a palindrome");
              break;
          }
          if ((array[k] == reverse[k]) &amp;&amp; (k == len -1))
          {
              System.out.println("It is a palindrome");
          }
      }
  
  }
  
  }
  </code></pre>