Without any comparison, find out the larger number of two numbers public class twonumwithoutjudge{//Judge a number of symbols (return 0 negative, 1 positive) public static int getsign (int x)
{return ((x>>31) ^1) &1;
}//Method 1 (limited premise A is not equal to B, may overflow) public static int GetMax01 (int a,int b) {int c=a-b;
int d=b-a;
int c=getsign (C);
int d=getsign (D);
return c*a+d*b;
}//XOR or operation public static int Getflip (int n) {return n^1;
///Get a number of symbols (1 is positive, 0 is negative) public static int sign (int n) {return ((n>>31) &1) ^1;
}//Method 2 public static int GetMax02 (int a,int b) {int c=a-b;
int Sa=sign (a);
int sb=sign (b);
int sc=sign (c);
int DIFSAB=SA^SB;
int Samesab=getflip (DIFSAB);
int RETRUNA=DIFSAB*SA+SAMESAB*SC;
int Retrunb=getflip (Retruna);
return A*RETRUNA+B*RETRUNB; } PubLic static void Main (String[]args) {//system.out.println ("Hello");
int a = 100;
int b=120;
System.out.println (GetMax01 (a,b));
System.out.println (GetMax02 (a,b)); }
}