Arduino status of bit
you can do it in a single line:

bool isSet = (var &amp; (1 &lt;&lt; bitNumber)) != 0;


1 &lt;&lt; bitNumber is a bit shift in this case it means that the 1 will be multiplied with the power of 2 

&amp; is the bitwise AND operator. The each bit of the result is 1 if and only if both the corresponding bits in the inputs is 1.