public static int add(int a, int b) {
        if (a > 0 && b > Integer.MAX_VALUE - a)
            throw new IllegalArgumentException("Addition overflow!");
        if (a < 0 && b < Integer.MIN_VALUE - a)
            throw new IllegalArgumentException("Addition underflow!");
        return a + b;
    }