Bit Manipulation Basics
Learn Bit Manipulation Basics (Foundations, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Bit Manipulation Basics Integers are stored as bits, and the bitwise operators work on those bits directly and very fast. & (AND), | (OR), ^ (XOR), ~ (NOT) and the shifts << and >> let you test, set, clear and flip single bits. Shifting left by k multiplies by 2 k .