Rabu, 28 Juli 2021

Difference between Right shift and Unsigned right shift in Java ( >> and >>> ) Example

There are two types of right shift operator in Java >> and >>>,  former is known as right shift and later is known as right shift with zero fill or simply unsigned right shift operator in Java.  Though both of them are known as bit shift operators and moves bits patterns towards right hand side of a bit sequence, there is a subtle difference between them. When we use right shift operator i.e. ">>" it keeps the sign bit intact i.e. if the original number is negative then it will remain negative even after right shift i.e. first or most significant bit never lost, doesn't matter how many times you shift.

Lorem ipsum is simply dummy text of the printing and typesetting industry.

Comments


EmoticonEmoticon