title: Java - Check if input is a positive integer, negative integer, natural number and so on.
body: <p>Is there any in-built method in Java where you can find the user input's type whether it is positive, or negative and so on? The code below doesn't work. I am trying to find a way to input any in-built method that can do it at the if statement. </p>
  
  <pre><code>import java.util.Scanner;
  
  public class Compare {
  
      public static void main(String[] args) { 
  
          Scanner input = new Scanner(System.in);
  
          System.out.print("Enter a number: ");
          int number = input.nextInt();
  
          if(number == int) 
              System.out.println("Number is natural and positive.");
      }
  }
  </code></pre>