...
| Code Block | ||
|---|---|---|
| ||
byte[] b = new byte[4]; ... int result = 0; for (int i = 0; i < 4; i++) { result = ((result << 8) | b[i]); } |
Compliant Solution (Left Shift)
...
| Code Block | ||
|---|---|---|
| ||
byte[] b = new byte[4]; ... int result = 0; for (int i = 0; i < 4; i++) { result = ((result << 8) | (b[i] & 0xff)); } |
Noncompliant Code Example (Compound Addition and Assignment)
...