Class BitMaskUtil

java.lang.Object
org.camunda.bpm.engine.impl.util.BitMaskUtil

public class BitMaskUtil extends Object
Util class for manipulating bit-flag in ints. Currently, only 8-bits are supporten, but can be extended to use all 31 bits in the integer (1st of 32 bits is used for sign).
Author:
Frederik Heremans
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getMaskForBit(int bitNumber)
     
    static boolean
    isBitOn(int value, int bitNumber)
    Check if the bit is set to '1'
    static int
    setBit(int value, int bitNumber, boolean bitValue)
    Set bit to '0' or '1' in the given int.
    static int
    setBitOff(int value, int bitNumber)
    Set bit to '0' in the given int.
    static int
    setBitOn(int value, int bitNumber)
    Set bit to '1' in the given int.

    Methods inherited from class java.lang.Object

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

    • BitMaskUtil

      public BitMaskUtil()
  • Method Details

    • setBitOn

      public static int setBitOn(int value, int bitNumber)
      Set bit to '1' in the given int.
      Parameters:
      current - integer value
      bitNumber - number of the bit to set to '1' (right first bit starting at 1).
    • setBitOff

      public static int setBitOff(int value, int bitNumber)
      Set bit to '0' in the given int.
      Parameters:
      current - integer value
      bitNumber - number of the bit to set to '0' (right first bit starting at 1).
    • isBitOn

      public static boolean isBitOn(int value, int bitNumber)
      Check if the bit is set to '1'
      Parameters:
      value - integer to check bit
      number - of bit to check (right first bit starting at 1)
    • setBit

      public static int setBit(int value, int bitNumber, boolean bitValue)
      Set bit to '0' or '1' in the given int.
      Parameters:
      current - integer value
      bitNumber - number of the bit to set to '0' or '1' (right first bit starting at 1).
      bitValue - if true, bit set to '1'. If false, '0'.
    • getMaskForBit

      public static int getMaskForBit(int bitNumber)