L.3. BitSet Class
Class BitSet makes it easy to create and manipulate bit sets, which are useful for representing sets of boolean flags. BitSets are dynamically resizable—more bits can be added as needed,and a BitSet will grow to accommodate the additional bits. Class BitSet provides two constructors—a no-argument constructor that creates an empty BitSet and a constructor that receives an integer representing the number of bits in the BitSet. By default, each bit in a BitSet has a false value—the underlying bit has the value 0. A bit is set to true (also called “on”) with a call to BitSet method set, which receives the index of the bit to set as an argument. This makes the underlying value of that bit 1. Note that bit indices are zero based, ...
Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.