Used bit masking to get binary value