| java.lang.Object | |
| ↳ | java.util.BitSet | 
The BitSet class implements a
 bit array.
 Each element is either true or false. A BitSet is created with a given size and grows
 automatically if this size is exceeded.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Creates a new  BitSetwith size equal to 64 bits. | |||||||||||
| Creates a new  BitSetwith size equal tobitCount, rounded up to
 a multiple of 64. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Logically ands the bits of this  BitSetwithbs. | |||||||||||
| Clears all bits in this  BitSetwhich are also set inbs. | |||||||||||
| Returns the number of bits that are  truein thisBitSet. | |||||||||||
| Clears the bit at index  index. | |||||||||||
| Clears all the bits in this  BitSet. | |||||||||||
| Clears the range of bits  [fromIndex, toIndex). | |||||||||||
| Creates and returns a copy of this  Object. | |||||||||||
| Compares this instance with the specified object and indicates if they
 are equal. | |||||||||||
| Flips the bit at index  index. | |||||||||||
| Flips the range of bits  [fromIndex, toIndex). | |||||||||||
| Returns the bit at index  index. | |||||||||||
| Returns a new  BitSetcontaining the
 range of bits[fromIndex, toIndex), shifted down so that the bit
 atfromIndexis at bit 0 in the newBitSet. | |||||||||||
| Returns an integer hash code for this object. | |||||||||||
| Returns true if  this.and(bs)is non-empty, but may be faster than computing that. | |||||||||||
| Returns true if all the bits in this  BitSetare set to false, false otherwise. | |||||||||||
| Returns the number of bits up to and including the highest bit set. | |||||||||||
| Returns the index of the first bit that is clear on or after  index. | |||||||||||
| Returns the index of the first bit that is set on or after  index, or -1
 if no higher bits are set. | |||||||||||
| Logically ors the bits of this  BitSetwithbs. | |||||||||||
| Sets the bit at index  indextostate. | |||||||||||
| Sets the range of bits  [fromIndex, toIndex)tostate. | |||||||||||
| Sets the range of bits  [fromIndex, toIndex). | |||||||||||
| Sets the bit at index  indexto true. | |||||||||||
| Returns the capacity in bits of the array implementing this  BitSet. | |||||||||||
| Returns a string containing a concise, human-readable description of the
 receiver: a comma-delimited list of the indexes of all set bits. | |||||||||||
| Logically xors the bits of this  BitSetwithbs. | |||||||||||
| [Expand] Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From class
  java.lang.Object | |||||||||||
Creates a new BitSet with size equal to bitCount, rounded up to
 a multiple of 64.
| NegativeArraySizeException | if bitCount < 0. | 
|---|
Clears all bits in this BitSet which are also set in bs.
Returns the number of bits that are true in this BitSet.
Clears the bit at index index.
| IndexOutOfBoundsException | if index < 0. | 
|---|
Clears all the bits in this BitSet. This method does not change the capacity.
 Use clear if you want to reuse this BitSet with the same capacity, but
 create a new BitSet if you're trying to potentially reclaim memory.
Clears the range of bits [fromIndex, toIndex).
| IndexOutOfBoundsException | if fromIndexortoIndexis negative, or iftoIndexis smaller thanfromIndex. | 
|---|
Creates and returns a copy of this Object. The default
 implementation returns a so-called "shallow" copy: It creates a new
 instance of the same class and then copies the field values (including
 object references) from this instance to the new instance. A "deep" copy,
 in contrast, would also recursively clone nested objects. A subclass that
 needs to implement this kind of cloning should call super.clone()
 to create the new instance and then create deep copies of the nested,
 mutable objects.
Compares this instance with the specified object and indicates if they
 are equal. In order to be equal, o must represent the same object
 as this instance using a class-specific comparison. The general contract
 is that this comparison should be reflexive, symmetric, and transitive.
 Also, no object reference other than null is equal to null.
 
The default implementation returns true only if this ==
 o. See Writing a correct
 equals method
 if you intend implementing your own equals method.
 
The general contract for the equals and hashCode() methods is that if equals returns true for
 any two objects, then hashCode() must return the same value for
 these objects. This means that subclasses of Object usually
 override either both methods or neither of them.
| o | the object to compare this instance with. | 
|---|
true if the specified object is equal to this Object; false otherwise.Flips the bit at index index.
| IndexOutOfBoundsException | if index < 0. | 
|---|
Flips the range of bits [fromIndex, toIndex).
| IndexOutOfBoundsException | if fromIndexortoIndexis negative, or iftoIndexis smaller thanfromIndex. | 
|---|
Returns the bit at index index. Indexes greater than the current length return false.
| IndexOutOfBoundsException | if index < 0. | 
|---|
Returns a new BitSet containing the
 range of bits [fromIndex, toIndex), shifted down so that the bit
 at fromIndex is at bit 0 in the new BitSet.
| IndexOutOfBoundsException | if fromIndexortoIndexis negative, or iftoIndexis smaller thanfromIndex. | 
|---|
Returns an integer hash code for this object. By contract, any two
 objects for which equals(Object) returns true must return
 the same hash code value. This means that subclasses of Object
 usually override both methods or neither method.
 
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
 hashCode method
 if you intend implementing your own hashCode method.
Returns true if this.and(bs) is non-empty, but may be faster than computing that.
Returns true if all the bits in this BitSet are set to false, false otherwise.
Returns the number of bits up to and including the highest bit set. This is unrelated to
 the size() of the BitSet.
Returns the index of the first bit that is clear on or after index.
 Since all bits past the end are implicitly clear, this never returns -1.
| IndexOutOfBoundsException | if index < 0. | 
|---|
Returns the index of the first bit that is set on or after index, or -1
 if no higher bits are set.
| IndexOutOfBoundsException | if index < 0. | 
|---|
Sets the bit at index index to state.
| IndexOutOfBoundsException | if index < 0. | 
|---|
Sets the range of bits [fromIndex, toIndex) to state.
| IndexOutOfBoundsException | if fromIndexortoIndexis negative, or iftoIndexis smaller thanfromIndex. | 
|---|
Sets the range of bits [fromIndex, toIndex).
| IndexOutOfBoundsException | if fromIndexortoIndexis negative, or iftoIndexis smaller thanfromIndex. | 
|---|
Sets the bit at index index to true.
| IndexOutOfBoundsException | if index < 0. | 
|---|
Returns the capacity in bits of the array implementing this BitSet. This is
 unrelated to the length of the BitSet, and not generally useful.
 Use nextSetBit(int) to iterate, or length() to find the highest set bit.
Returns a string containing a concise, human-readable description of the
 receiver: a comma-delimited list of the indexes of all set bits.
 For example: "{0,1,8"}.