Java BitSet tutorial with example program
By candid | Posted :
Dec 14, 2015
| Updated :
Dec 14, 2015
All Implemented Interfaces:
Serializable, Cloneable
public class BitSet
extends Object
implements Cloneable, Serializable
{
//
}
Since:
JDK1.0
See Also:
Serialized Form
Constructor Summary
BitSet()
Creates a new bit set.
BitSet(int nbits)
Creates a bit set whose initial size is large enough to explicitly represent bits with indices in the range 0 through nbits-1.
Method Summary
Performs a logical AND of this target bit set with the argument bit set.
Clears all of the bits in this BitSet whose corresponding bit is set in the specified BitSet.
Returns the number of bits set to true in this BitSet.
Sets all of the bits in this BitSet to false.
Sets the bit specified by the index to false.
Sets the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to false.
Cloning this BitSet produces a new BitSet that is equal to it.
Compares this object against the specified object.
Sets the bit at the specified index to the complement of its current value.
Sets each bit from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to the complement of its current value.
Returns the value of the bit with the specified index.
Returns a new BitSet composed of bits from this BitSet from fromIndex (inclusive) to toIndex (exclusive).
Returns the hash code value for this bit set.
Returns true if the specified BitSet has any bits set to true that are also set to true in this BitSet.
Returns true if this BitSet contains no bits that are set to true.
Returns the "logical size" of this BitSet: the index of the highest set bit in the BitSet plus one.
Returns the index of the first bit that is set to false that occurs on or after the specified starting index.
Returns the index of the first bit that is set to true that occurs on or after the specified starting index.
Performs a logical OR of this bit set with the bit set argument.
Returns the index of the nearest bit that is set to false that occurs on or before the specified starting index.
Returns the index of the nearest bit that is set to true that occurs on or before the specified starting index.
Sets the bit at the specified index to true.
Sets the bit at the specified index to the specified value.
Sets the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to true.
Sets the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to the specified value.
Returns the number of bits of space actually in use by this BitSet to represent bit values.
Returns a new byte array containing all the bits in this bit set.
Returns a new long array containing all the bits in this bit set.
Returns a string representation of this bit set.
Returns a new bit set containing all the bits in the given byte array.
Returns a new bit set containing all the bits in the given byte buffer between its position and limit.
Returns a new bit set containing all the bits in the given long array.
Returns a new bit set containing all the bits in the given long buffer between its position and limit.
Performs a logical XOR of this bit set with the bit set argument.
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Related Post
Comments