This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.

| (Bitwise OR) sets a bit to 1 if one or both of the corresponding bits in its operands are 1, and to 0 if both of the corresponding bits are 0. In other words, | returns one in all cases except where the corresponding bits of both operands are zero.(that means , both bits are ZERO , then it ZERO ) The resulting bit pattern is the "set" (1 or true) bits of any of the two operands. This property is used to "set" or "turn on" a "flag" (bit set to one) in your flags or options variable regardless of whether that flag was set previously or not. Multiple flag bits can be set if a combo MASK is defined.

So if you | those, you get a number for which each bit represents a setting.

| has a close relative in &. While | results in 0 only if both bits are 0, & results in 1 only if both bits are 1. You can use that to check if a specific bit is set: if (bits & IS_INDEXED == 0) // IS_INDEXED is not set if (bits & STORE_TERMVECTOR == 0) // STORE_TERMVECTOR is not set