请定义一个宏,比较两个数a、b的大小,不能使用大于、小于、if语句 

解决方案 »

  1.   


    #     int a = 1;  
    #     int b = 2;  
    #     String[] buf = { "a=>b", "a < b" };  
    #     int id1 = (a - b) >>> 31;  
    #     System.out.println(id1); // 1  
    #     System.out.println(buf[id1]); // a < b  
      

  2.   

    有一个人的名字叫 李明明难道人家的名字是李明吗?
    >>>号是位运算,不是逻辑运算
      

  3.   

    算是偷懒的办法了 呵呵
    import java.util.*;
    public class Test 
    {
    public static void main(String[] args) 
    {
    int a = 30;
    int b = 10;
    int[] c = {a,b};
    Arrays.sort(c);//数组按升序排序
    System.out.println(c[1]+"大于"+c[0]);
    }
    }