Why Java doesn't support <<< operator

前端 未结 4 665
醉梦人生
醉梦人生 2021-02-05 09:22

Why doesn\'t Java support the <<< (unsigned left shift) operator, but does support the >>> (unsigned right shift) operator?

4条回答
  •  臣服心动
    2021-02-05 10:01

    I think this is a design mistake. The << is not arithmetic shift. << is supposed multiply 2 if you do

    0xF0FFFFFF << 4

    it return a positive number! a negative number multiply 2 should never get a positive number. the << is doing <<< work.

提交回复
热议问题