Check out example codes for "java integer compareto". It will help you in understanding the concepts better.

Code Example 1

public class IntegerCompareToExample {  
    public static void main(String[] args) {      
        // compares two Integer values numerically  
          Integer x = new Integer("90");  
          Integer y= new Integer("58");  
          int retResult =  x.compareTo(y);        
          if(retResult > 0) {  
             System.out.println("x is greater than y");  
          } else if(retResult< 0) {  
             System.out.println("x is less than y");  
          } else {  
             System.out.println("x is equal to y");  
          }  
    }  
}

Learn ReactJs, React Native from akashmittal.com