Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Greater than 3 times >>> in JAVA do exactly?

Tags:

java

I know that >> (two times greater than) is shifting , but what does >>> do exactly ?

    System.out.println(16>>>2);  // OK

    System.out.println(8>>>2);   // OK 

    System.out.println(8>>>2);  // OK 

    System.out.println(8<<<2);  // not OK
like image 548
JAN Avatar asked Dec 27 '13 18:12

JAN


2 Answers

>>> Shift right zero fill operator.
The left operands value is moved right by the number of bits specified by the right operand and shifted values are filled up with zeros.

like image 199
Rakesh KR Avatar answered Oct 06 '22 00:10

Rakesh KR


>>> is valid operator <<< in not valid operator in java if try to use this it give

Syntax error on token "<", delete this token

>>> :Shift right zero fill operator. The left operands value is moved right by the number of bits specified by the right operand and shifted values are filled up with zeros.

More information:

why is 1>>32 == 1?

like image 42
Sitansu Avatar answered Oct 06 '22 00:10

Sitansu