public class BitArray
extends java.lang.Object
Constructor and Description |
---|
BitArray(boolean[] bits)
Create a BitArray whose bits are those of the given array
of Booleans.
|
BitArray(int length)
Creates a BitArray of the specified size, initialized to zeros.
|
BitArray(int length,
byte[] a)
Creates a BitArray of the specified size, initialized from the
specified byte array.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object obj) |
boolean |
get(int index)
Returns the indexed bit in this BitArray.
|
int |
hashCode()
Returns a hash code value for this bit array.
|
int |
length()
Returns the length of this BitArray.
|
void |
set(int index,
boolean value)
Sets the indexed bit in this BitArray.
|
boolean[] |
toBooleanArray()
Return a boolean array with the same bit values a this BitArray.
|
byte[] |
toByteArray()
Returns a Byte array containing the contents of this BitArray.
|
java.lang.String |
toString()
Returns a string representation of this BitArray.
|
public BitArray(int length) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public BitArray(int length, byte[] a) throws java.lang.IllegalArgumentException
8*a.length >= length
.java.lang.IllegalArgumentException
public BitArray(boolean[] bits)
public boolean get(int index) throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public void set(int index, boolean value) throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public int length()
public byte[] toByteArray()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean[] toBooleanArray()
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object