...
The intent of the expression in this noncompliant code example is to add the variable OFFSET
to the result of the bitwise logical AND between x
and MASK
.:
Code Block | ||
---|---|---|
| ||
public static final int MASK = 1337; public static final int OFFSET = -1337; public static int computeCode(int x) { return x & MASK + OFFSET; } |
...
By mathematical convention, multiplication is performed before addition; parentheses are redundant in this case.:
Code Block | ||
---|---|---|
| ||
x + (y * z) |
...