Bit mask first 2 bits of 16 bits for accelerometer The datasheet for the accelerometer states that:



Here is the data output from the accelerometer:



I have tried to mask the first two bits using a bitwise AND command with B0011111111111111.

I tried to use this code, but unfortunately the first 2 bits are still "11" so the value has not changed:

int bresult=0b0011111111111111&amp;result;
Serial.print(bresult,BIN);


How would I bits mask the first two bits and will arduino automatically know how to convert to twos compliment?

The variable result is of data type "long"

According to an answer, I tried:

int bresult= result&lt;&lt;2;
Serial.print(bresult,BIN);


I got this result which is great but is it possible to remove the last two zeros because this is making my value larger?
The image below shows result then bresult.
Since it won't convert to two's complement if the sign bit is the 14 bit instead of the 16th, it would be easier to just shift the value left by 2. So

int bresult= result&lt;&lt;2;


Since &lt;&lt;2 is the same as *4 the result will be 4 times as high. So you need to divide the result by 4. Since you already have to multiply by 0.025 (or divide by 40), you end up having to multiply by 0.00625 (or divide by 160).