Check Bit
Learn Check Bit (Bit Manipulation, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Testing Whether a Specific Bit is Set To CHECK bit i : AND the number with a mask having only bit i set, then compare to 0 - (num & (1 << i)) != 0 . Every OTHER bit gets ANDed to 0 regardless of its value, leaving only bit i's actual value to determine the result.