code: public void displayMenu() {
          while (true) {
              ConsoleMenu.println("");
              ConsoleMenu.println("Menu Options");
  
              final int size = menu.size();
  
              displayMenu(size);
  
              int opt;
  
              do {
                  opt = ConsoleMenu.getInt("Enter your choice:", -1);
              } while ((opt <= 0 || opt > methods.size()) && opt != EXIT_CODE);
  
              if (opt == EXIT_CODE) {
                  callTearDownIfRequired();
                  return;
              }
  
              callMenuOption(opt);
          }
      }
docs: display the menu, the application goes into a loop which provides the
  menu and fires the entries selected. It automatically adds an entry to
  exit.