Class Bits


  • public final class Bits
    extends java.lang.Object
    Utility class for manipulating bits. TODO Pavel: I think this can be optimized. There're two many method calls to set bits, etc. We aren't usually using arbitrary masks and can have specialized methods for specific masks.
    Since:
    0.7
    Version:
    0.7
    Author:
    Pavel Klinov
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long bitMask​(int theStartBit, int theEndBit)  
      static long clearBits​(long theLong, int theStartBit, int theEndBit)  
      static long extractBits​(long theLong, int theStartBit, int theEndBit)  
      static boolean isSet​(long theLong, int theIndex)  
      static long setBits​(long theLong, int theStartBit, int theEndBit)  
      static long setBits​(long theLong, long theBits, int theStartBit, int theEndBit)  
      • Methods inherited from class java.lang.Object

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

      • isSet

        public static boolean isSet​(long theLong,
                                    int theIndex)
      • setBits

        public static long setBits​(long theLong,
                                   int theStartBit,
                                   int theEndBit)
      • setBits

        public static long setBits​(long theLong,
                                   long theBits,
                                   int theStartBit,
                                   int theEndBit)
      • extractBits

        public static long extractBits​(long theLong,
                                       int theStartBit,
                                       int theEndBit)
      • clearBits

        public static long clearBits​(long theLong,
                                     int theStartBit,
                                     int theEndBit)
      • bitMask

        public static long bitMask​(int theStartBit,
                                   int theEndBit)