Markus Markus - 3 years ago 568
Java Question

Java Operator: |=

I just came across the following line inside some sourcecode.

int sequ |= element.sequence

What does the operator |= mean ? I haven't seen that before.

Answer Source

It is similar to +=, -=, /=, or *=. But with bitwise OR instead.

This is equivalent to:

sequ = sequ | element.sequence;

where | ORs all bits in the number.
