...
Code Block | ||
---|---|---|
| ||
byte[] b = new byte[] {-1, -1, -1, -1};
int result = 0;
for (int i = 0; i < 4; i++) {
result = ((result << 8) | (b[i] & 0xff));
}
|
...
Wiki Markup |
---|
\[[Steele 1977|AA. Bibliography#Steele 77]\] |
...
FIO14NUM01-J. Use an int to capture the return value of functions that read a character or byte 03. Integers (INT) Do not assume that the remainder operator always returns a non-negative result for integral operands 03. Numeric Types and Operations (NUM) NUM04-J. Use shift operators correctly