...
Code Block | ||
---|---|---|
| ||
if(a == Integer.MIN_VALUE && b == -1) throw ArithmeticException;//May be Integer.MIN_VALUE again???? else result = a/b;//safe operation |
...
Modulo
For modulo operator the only problem is if we take the modulo of Integer.MIN_VALUE with -1. The result is always 0 in JAVA so we are back to the previous rule (for division)
...
3) There is a new operator in Java <<< Java >>> that performs unsigned right shift
...