Class Bit


  • public class Bit
    extends Object
    The class is used to read/set bit value for a byte array
    • Constructor Summary

      Constructors 
      Constructor Description
      Bit()  
    • Constructor Detail

      • Bit

        public Bit()
    • Method Detail

      • isBitSet

        public static boolean isBitSet​(byte[] array,
                                       long bit)
        Read a bit value from a byte array with the specified bit position.
        Parameters:
        array - Specify the byte array.
        bit - Specify the bit position.
        Returns:
        Return the bit value in the specified bit position.
      • setBit

        public static void setBit​(byte[] array,
                                  long bit)
        Set a bit value to "On" in the specified byte array with the specified bit position.
        Parameters:
        array - Specify the byte array.
        bit - Specify the bit position.
      • clearBit

        public static void clearBit​(byte[] array,
                                    long bit)
        Set a bit value to "Off" in the specified byte array with the specified bit position.
        Parameters:
        array - Specify the byte array.
        bit - Specify the bit position.