int a1 = 12<<1;//24
int a2 = -12<<2;//-48
int a3 = 128<<2;//512
int a4 = 129<<2;//516
Discard the binary number at the beginning. Adds a bit 0 to the tail of the binary number.
A*2^b<===a<<b
The number a left shift B-bit result is A*2 's B-square
Binary form of 112
1 >12
0000 0000 0000 1100
0000 0000 0001 1000
----------------------equivalent to 10 binary 24
Two
-12 binary
1>12 binary
0000 0000 0000 1100
2> Reverse
1111 1111 1111 0011
3> plus 1
1111 1111 1111 0100
3> left move two bit
1111 1111 1101 0000
4>
into a decimal form
4.1>-1
1111 1111 1100 1111
4.2 > Take Reverse
0000 0000 0011 0000
48
Because it is a negative number, it is-48
--------------------------
Three
int a3 = 128<<2;
1>128 binary
0000 0000 1000 0000
2> left two bits in the tail two bits 0
0000 0000 0000 0000
Decimal number is 512
four int a4 = 129<<2;//516
0000 0000 1000 0001
129 of the Decimal
Move left two-bit
0000 0010 0000 0100
Decimal is 516
Left move operator