What happening here '>>>' operator in java?

This question already has an answer here:

  • What are bitwise shift (bit-shift) operators and how do they work? 8 answers

  • >>> is the unsigned right shift operator. Since a is 60 and 60 is 111100 in binary, when you shift right twice you get 1111 which is 15.


    >>> is the logical (or unsigned) right shift operator.
    

    lets x= 10000000 00000000 00000000 01100000

    x >>> 4 then x = 00001000 00000000 00000000 00000110

    you can see the rightmost sign bit is also getting shifted to wards right but this is not true for >> .

    if x = 00000000 00000000 00000000 00111100 ie x = 60

    now x>>>2 so x = 00000000 00000000 00000000 001111 which is x = 15 .


    检查Bitwise和Bit Shift运算符的文档。

    链接地址: http://www.djcxy.com/p/12578.html

    上一篇: “在JavaScript中做什么?

    下一篇: java中发生了什么'>>>'运算符?