Markus Markus - 5 years ago 755
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download