144 不用做任何比较判断运算符找出两个整数中的较大的值
Table of Contents

ac

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static Scanner sc = new Scanner(System.in);

    public static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

    public static long mod = (long)Math.pow(2,29);

    public static void main(String[] args) throws Exception {
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(getMaxVal(a, b));
    }

    static int getMaxVal(int a, int b){
        int sign1 = (a >> 31) & 1;
        int sign2 = (b >> 31) & 1;
        if( (sign1 ^ sign2) == 1){ // 不同符号
            if(sign1 == 0){
                return a;
            }
            return b;
        }else{ // 同符号
            int c = a - b; // 确保相减不会溢出
            if(((c >> 31) & 1) == 0){
                return a;
            }
            return b;
        }
    }

}
/*
3 1
3 -3
-3 3
-1 -3
*/