title: Only let users input positive integers (no decimals or strings)?
body: <p>I know how to ask the user to input positive integers, but I don't know how approach the code to avoid an input error such as a decimal or string input. </p>
  
  <pre><code>  int seedValue;
    double angle, gunpowder;
  
    System.out.println("Please enter a positive integer seed value: ");
    seedValue = input.nextInt();
  
       while (seedValue &lt;= 0) {  
          System.out.println("Please enter a positive integer seed value: ");
          seedValue = input.nextInt();
       }
  
       System.out.println("That target is " +
        threeDec.format(gen.nextDouble() * 1000) + "m away.");
  </code></pre>