User input asked twice
<p>The code below asks to input the numbers two times.</p>

<pre><code>public class Palindrome {

  public static void main(String[] args) {
     boolean x;
     boolean display;

     x = check();
     display = display();
  }

  private static int getUserInput() {
     int inputNumber = 0;
     String answer = JOptionPane.showInputDialog(null, "Please enter a five digit number","Enter a number");
     inputNumber = Integer.parseInt(answer);
     return inputNumber;
  }

  private static boolean check(){
     int inputNumber = getUserInput();
     int number = inputNumber;
     int[] myArray = new int[5];

     for (int i = 0; i &lt; myArray.length; i++) {
        myArray[i] = (int) (number /(Math.pow(10,i)) % 10);
     }

     if(myArray[0] == myArray[4] &amp;&amp; myArray[1] == myArray[3])
        return true;
     else
        return false;
  }

  public static boolean display(){
     if (check() == true) {
        JOptionPane.showMessageDialog(null, "This number is a Palindrome",
           "Excellent!",
           JOptionPane.INFORMATION_MESSAGE);
     } else
        JOptionPane.showMessageDialog(null,
           "Number is not a Palindrome!",
           "Sorry",
           JOptionPane.ERROR_MESSAGE);
        return false;
     }
}
</code></pre>

<p>I want it to ask just once.</p>

<p>Thanks</p>
