All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class netscape.security.util.BitArray

netscape.security.util.BitArray

public class BitArray
A packed array of booleans.


Constructor Index

 o BitArray(boolean[])
Create a BitArray whose bits are those of the given array of Booleans.
 o BitArray(int)
Creates a BitArray of the specified size, initialized to zeros.
 o BitArray(int, byte[])
Creates a BitArray of the specified size, initialized from the specified byte array.

Method Index

 o clone()
 o equals(Object)
 o get(int)
Returns the indexed bit in this BitArray.
 o hashCode()
Returns a hash code value for this bit array.
 o length()
Returns the length of this BitArray.
 o set(int, boolean)
Sets the indexed bit in this BitArray.
 o toBooleanArray()
Return a boolean array with the same bit values a this BitArray.
 o toByteArray()
Returns a Byte array containing the contents of this BitArray.
 o toString()
Returns a string representation of this BitArray.

Constructors

 o BitArray
 public BitArray(int length) throws IllegalArgumentException
Creates a BitArray of the specified size, initialized to zeros.

 o BitArray
 public BitArray(int length,
                 byte a[]) throws IllegalArgumentException
Creates a BitArray of the specified size, initialized from the specified byte array. The most significant bit of a[0] gets index zero in the BitArray. The array a must be large enough to specify a value for every bit in the BitArray. In other words, 8*a.length >= length.

 o BitArray
 public BitArray(boolean bits[])
Create a BitArray whose bits are those of the given array of Booleans.

Methods

 o get
 public boolean get(int index) throws ArrayIndexOutOfBoundsException
Returns the indexed bit in this BitArray.

 o set
 public void set(int index,
                 boolean value) throws ArrayIndexOutOfBoundsException
Sets the indexed bit in this BitArray.

 o length
 public int length()
Returns the length of this BitArray.

 o toByteArray
 public byte[] toByteArray()
Returns a Byte array containing the contents of this BitArray. The bit stored at index zero in this BitArray will be copied into the most significant bit of the zeroth element of the returned byte array. The last byte of the returned byte array will be contain zeros in any bits that do not have corresponding bits in the BitArray. (This matters only if the BitArray's size is not a multiple of 8.)

 o equals
 public boolean equals(Object obj)
 o toBooleanArray
 public boolean[] toBooleanArray()
Return a boolean array with the same bit values a this BitArray.

 o hashCode
 public int hashCode()
Returns a hash code value for this bit array.

Returns:
a hash code value for this bit array.
 o clone
 public Object clone()
 o toString
 public String toString()
Returns a string representation of this BitArray.


All Packages  Class Hierarchy  This Package  Previous  Next  Index