getUserInputIntegerBetween

static public int getUserInputIntegerBetween(int min, int max) {
   int value = 0;
   Scanner scan = new Scanner(System.in);
   do {
      System.out.printf("Please enter value [%d-%d]: ", min, max);
      try {
         value = scan.nextInt();
      }
      catch (Exception e) {
         System.out.printf("Error! Please re-enter!\n");
         scan.next();
         continue;
      }
   } while (value < min || value > max);
   return value;
}