Visit this site KNow more about Operators:
Bitwise operations
- Kotlin provides a set of bitwise operations on integer numbers.
- They operate on the binary level directly with bits of the numbers' representation.
- Bitwise operations are represented by functions that can be called in infix form.
- They can be applied only to Int and Long:
val x = (1 shl 2) and 0x000FF000
⇒ Here is the complete list of bitwise operations:
- shl(bits) – signed shift left
- shr(bits) – signed shift right
- ushr(bits) – unsigned shift right
- and(bits) – bitwise AND
- or(bits) – bitwise OR
- xor(bits) – bitwise XOR
- inv() – bitwise inversion