There are two type of bit shifting.
Left shift: shifting bits in left side. < < left shift operator. Use left shift like this number< < shift.
For Eg:
4<<1
This will shift one bit left side of number 4. I.e., 4 is 0100. If we shift one bit of 4 in left side, 1000 will be the answer i.e 8.
Simply we can calculate the value after left shifting by formula i.e., "number*2^shift". 4*2=8. Right shift: > > this will shift bits in right direction. 4 > > 2. The value after shifting is 0001. Simply we can calculate right shift by this formula "number/2^shift".
4/2^2 =4/4=1.