What Does this << Statement Mean?

This question already has an answer here:

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

  • This is also called the shift operator. It will shift de bits n positions to the left. Shifting the bits by one positions is the same as multiplying or dividing by 2.


    It is a left-shift operator.

    It applies on the bit representation of 1 and shift it's bits to left by 2 position.


    << is a binary Left Shift operator. The left operands value is shifted left by the number of bits specified by the right operand. and 0 are padded in the right. So the binary of 1 ie, 1 is shifted left 2 places and becomes 100 which is 4 in decimal number system. So i is assigned 4 .

    Here is a quick tutorial that explains bitwise operations

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

    上一篇: java按位左移

    下一篇: 这个陈述是什么意思?