Bitwise AND, Bitwise Inclusive OR question, in Java
I've a few lines of code within a project, that I can't see the value of... buffer[i] = (currentByte & 0x7F) | (currentByte & 0x80); It reads the filebuffer from a file, stored as bytes, and then transfers then to buffer[i] as shown, but I can't understand what the overall purpose is, any ideas? Thanks As the other answers already stated, (currentByte & 0x7F) | (currentByte & 0x80) is equivalent to (currentByte & 0xFF) . The JLS3 15.22.1 says this is promoted to an int : When both operands of an operator &, ^, or | are of a type that is convertible (§5.1.8) to a primitive integral type, binary