The compareUnsigned() method of Integer class compares two int objects numerically by treating the values as unsigned.


public static int compareUnsigned(int x , int y)


The parameters ‘x’ and ‘y’ represent the first and second int value to compare.

 Return Value

This method returns an integer value.

  • It returns zero, if both the parameters are equal(x==y).
  • It returns value greater than zero, if x is greater than y as unsigned values(x>y).
  • It returns value less than zero, if x if smaller than y as unsigned values (x<y).

Example 1


Example 2


Pin It on Pinterest

Share This