Class Bit


  • public class Bit
    extends java.lang.Object
    Utilities for bit operations on an array.
    • Constructor Summary

      Constructors 
      Constructor Description
      Bit()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int arrayReadBit​(int index, int offset, byte[] buf)
      Read a bit state in a byte array.
      static void arrayWriteBit​(int state, int index, int offset, byte[] buf)
      Write the bit state in a byte array.
      • Methods inherited from class java.lang.Object

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

      • Bit

        public Bit()
    • Method Detail

      • arrayWriteBit

        public static void arrayWriteBit​(int state,
                                         int index,
                                         int offset,
                                         byte[] buf)
        Write the bit state in a byte array.
        Parameters:
        state - new state of the bit 1, 0
        index - bit index into byte array
        offset - byte offset into byte array to start
        buf - byte array to manipulate
      • arrayReadBit

        public static int arrayReadBit​(int index,
                                       int offset,
                                       byte[] buf)
        Read a bit state in a byte array.
        Parameters:
        index - bit index into byte array
        offset - byte offset into byte array to start
        buf - byte array to read from
        Returns:
        bit state 1 or 0