I used to use the >> operator for right shifting. Now I’ve just replaced it with >>> and found the same result. So I can’t figure out whether these two are fundamentally equal or not.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The first operator sign-extends the value, shifting in a copy of the sign bit; the second one always shifts in a zero.
The reason for this is to emulate unsigned integers for the purpose of doing bit operations, partially compensating for the lack of unsigned integral types in Java.