// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import javax.swing.JOptionPane;

public class ReadNums {
   public static boolean isNumber(String s) {
      if(s.length() <= 0) {
         return false;
      }
      for(int i = 0; i < s.length(); i++) {
         char c = s.charAt(i);
         if(c != ' ' && !Character.isDigit(c)) {
            return false;
         }
      }
      return true;
   }
   public static void main(String[] args) {
      for(int i = 0; i < 2; i++) {
         String s;
         do {
            s = JOptionPane.showInputDialog("Enter a number");
         } while(!isNumber(s));
         int v = Integer.parseInt(s);
         System.out.println(v);
      }
   }
}
