public class CompareAandB {
public static void main(String[] args) {
//test一下
System.out.println(compare(3, 5));
System.out.println(compare(1231, 23));
System.out.println(compare(9, 9));
}
public static int compare(int a , int b){
//a>b 则a-b整数,最高位为0 反之最高位为0
return ((a-b)&0x8000)==0?a:b;
}
}
public static void main(String[] args) {
//test一下
System.out.println(compare(3, 5));
System.out.println(compare(1231, 23));
System.out.println(compare(9, 9));
}
public static int compare(int a , int b){
//a>b 则a-b整数,最高位为0 反之最高位为0
return ((a-b)&0x8000)==0?a:b;
}
}