Possible Duplicate:
What is the following sign: <<?
Can someone please explain the << in the follow sample code?
final static public int MY_VAR = 1<<3;
Thank you!
Sure, it's a left shift - you're shifting the number "1" left by 3 bits, so the result will be 8.
See section 15.19 of the Java Language Specification for more details.
It's the bitwise left-shift operator. It shifts bits to the left, like so:
00000001 << 3 == 00001000
In other words, 1 << 3 == 8
, since you shift the 1 bit over by 3 places.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With