Class BitString


  • public class BitString
    extends java.lang.Object
    Arbitrary string of bits (zeros and ones). A bit string value can have any length including zero.
    • Constructor Summary

      Constructors 
      Constructor Description
      BitString​(byte[] bitString, int numBits)
      Construct a new bit string object.
      BitString​(BitString other)
      Copy Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBitString()
      Get the bit string as byte array.
      int getNumBits()
      The number of bits in the byte array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BitString

        public BitString​(byte[] bitString,
                         int numBits)
        Construct a new bit string object.
        Parameters:
        bitString - as a a byte array.
        numBits - the number of bits.
        Throws:
        java.lang.IllegalArgumentException - if the passed number of is is out of range.
        numBits <= (bitString.length - 1) * 8 + 1 || numBits > bitString.length * 8
      • BitString

        public BitString​(BitString other)
        Copy Constructor.
        Parameters:
        other - the other bit string,
    • Method Detail

      • getBitString

        public byte[] getBitString()
        Get the bit string as byte array.
        Returns:
        the bit string.
      • getNumBits

        public int getNumBits()
        The number of bits in the byte array.
        Returns:
        the number of bits.
        See Also:
        getBitString()