Google doesn\'t seem to help with the following: in Java, what does the following mean?
long_num1 |= long_num2
Means long_num1 = long_num1 | long_num2
.
The |
is bitwise OR.
It's a bitwise OR logical operation.
1 | 0 = 1
1001 | 0101 = 1101
11110000 | 00001111 = 11111111
It's commonly used when one has to deal with bit fields. The long_num
values store multiple Boolean flags as individual bits of the whole integer.
Note however that Java has a built-in feature for dealing with bit fields: the BitSet class.