public static long addExact(long a, long b) {
        long result = a + b;
        checkNoOverflow((a ^ b) < 0 | (a ^ result) >= 0);
        return result;
    }
public static long addExact ( long a , long b ) { long result = a + b ; checkNoOverflow ( ( a ^ b ) < 0 | ( a ^ result ) >= 0 ) ; return result ; }
Returns the sum of {@code a} and {@code b}, provided it does not overflow.

@throws ArithmeticException if {@code a + b} overflows in signed {@code long} arithmetic