public static void main(final String[] args) {
   final Scanner sis = new Scanner(System.in);
   output(HELP_MESSAGE);
   while (sis.hasNext()) {
     if (sis.hasNextInt()) {
       final int next = sis.nextInt();
       output("You entered an Integer = %d", next);
     } else if (sis.hasNextLong()) {
       final long next = sis.nextLong();
       output("You entered a Long = %d", next);
     } else if (sis.hasNextDouble()) {
       final double next = sis.nextDouble();
       output("You entered a Double = %f", next);
     } else if (sis.hasNext("\\d+")) {
       final BigInteger next = sis.nextBigInteger();
       output("You entered a BigInteger = %s", next);
     } else if (sis.hasNextBoolean()) {
       final boolean next = sis.nextBoolean();
       output("You entered a Boolean representation = %s", next);
     } else if (sis.hasNext(DATE_PATTERN)) {
       final String next = sis.next(DATE_PATTERN);
       output("You entered a Date representation = %s", next);
     } else // unclassified
     {
       final String next = sis.next();
       if (isValidURL(next)) {
         output("You entered a valid URL = %s", next);
       } else {
         if (EXIT_COMMANDS.contains(next)) {
           output("Exit command %s issued, exiting!", next);
           break;
         } else if (HELP_COMMANDS.contains(next)) {
           output(HELP_MESSAGE);
         } else {
           output("You entered an unclassified String = %s", next);
         }
       }
     }
   }
   /*
      This will close the underlying Readable, in this case System.in, and free those resources.
      You will not be to read from System.in anymore after this you call .close().
      If you wanted to use System.in for something else, then don't close the Scanner.
   */
   sis.close();
   System.exit(0);
 }