title: How to check if an input is an int and is between two values
body: <p>I created a method to see if a value that the user entered is type <code>int</code> and is between <code>liminf</code> and <code>limsup</code>. It returns the value so I can use it as a menu option.
  The string <code>message</code> tells the user to enter something, and the <code>error</code> tells the user to use a number between <code>limunf</code> and <code>limsup</code>.</p>
  
  <p>My problem is that, for example, if the user enters the number 10 and the <code>liminf</code> is 7 and <code>limsup</code> e 9, it runs like the number 10 was between <code>limsup</code> and <code>liminf</code>.</p>
  
  <pre><code>public static int readInput(String message, String error, int liminf, int limsup, Scanner rd){
  
      int option = 0;
      do {
          option = rd.nextInt();
          System.out.println(message);
          while (!rd.hasNextInt()) {
              System.out.println("Please enter the option");
              rd.nextLine();
          }
          option = rd.nextInt();
          canal.nextLine();
      } while (option &gt; limsup || option &lt; liminf);
  
      return option;
  }
  </code></pre>