Bitwise right shift operators in Java In C/C++ there is only one right shift operator ‘>>’ which should be used only for positive integers or unsigned integers. Use of right shift operator for negative numbers is not recommended in C/C++, and when used for negative numbers, output is compiler dependent (See this ). Unlike C++, Java supports following two right shift operators. 1) >> (Signed right shift) In Java, the operator ‘>>’ is signed right shift operator. All integers are signed in Java, and it is fine to use >> for negative numbers.
Read full article from Bitwise right shift operators in Java | GeeksforGeeks
No comments:
Post a Comment