O'Reilly logo

Java™ How to Program, Seventh Edition by P. J. Deitel - Deitel & Associates, Inc., H. M. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required