+ 5
What does << and >> mean in Java
Java
5 odpowiedzi
+ 15
Those are bitshift operator's. Imagine an 8 bit integer, I.e 2:
2 in binary is
00000010,
2 >> 1, means shift 2 to the right once, the result is 00000001, which is decimal 1.
2 << 2, means shift 2 to the left twice, the result is 00001000, which is decimal 8
+ 10
@Abhishek nope
+ 1
they are bitwise bit shift operators
+ 1
The Java programming language also provides operators that perform bitwise and bit shift operations on integral types. The signed left shift operator << shifts a bit pattern to the left, and the signed right shift operator >> shifts a bit pattern to the right. The bit pattern is given by the left-hand operand, and the number of positions to shift by the right-hand operand. The unsigned right shift operator >>>shifts a zero into the leftmost position, while the leftmost position after >>depends on sign extension.
0
@Nikolay Nachev ,is the shift circular ?