The | is a bitwise OR instead of boolean OR ||
That means it will do OR on every bit like 2 is binary 10 and 4 is binary 100, results in 110.
If you calculate all your results above in binary numbers you will see.
This is useful for bitmasks or evaluating flags. If you program nearer to hardware you will often find this when setting register bits Or when parsing protocol data while communicating.
if (myVar | 0x2 > 0) {
// Bit two is set!
}
Of course there are other uses too.
There is also a bitwise AND & working the same way but ands the bits.