title: NumberFormatExceptions
body: <p>I am trying with a Utility function to get int and check if bad input results in<br>
  NumberFormat Exceptions,is there a way to work with Non-decimal Int for below function</p>
  
  <pre><code>//--- Utility function to get int using a dialog.
  
  public static int getInt(String mess) {
      int val;
      while (true) { // loop until we get a valid int
          String s = JOptionPane.showInputDialog(null, mess);
          try {
              val = Integer.parseInt(s);
              break;  // exit loop with valid int
          } catch (NumberFormatException nx) {
              JOptionPane.showMessageDialog(null, "Enter valid integer");
          }
      }
      return val;
  }
  
  //end getInt
  </code></pre>