...
| Code Block | ||
|---|---|---|
| ||
public static int getAbsAdd(int x, int y) {
assert x != Integer.MIN_VALUE;
assert y != Integer.MIN_VALUE;
int absX = Math.abs(x);
int absY = Math.abs(y);
assert (absX <= Integer.MAX_VALUE - absY);
return absX + absY;
}
|
The condition conditions checked by the Java assertion is reasonableassertions are reasonable. However, the validation code is not executed when assertions are disabled.
...