Java – the difference between the Java operators >> and >>>?

java

What is the difference between the operator >> and >>>?

Best Answer

>>> right shifts and fills with 0 at the left end, while >> fills with the sign bit.

This makes a difference for the signed integral types (i.e. all but byte), where a negative value has a set sign bit.