Class Bits
java.lang.Object
com.complexible.common.primitives.Bits
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
Modifier and TypeMethodDescriptionstatic longbitMask(int theStartBit, int theEndBit) static longclearBits(long theLong, int theStartBit, int theEndBit) static longextractBits(long theLong, int theStartBit, int theEndBit) static booleanisSet(long theLong, int theIndex) static longsetBits(long theLong, int theStartBit, int theEndBit) static longsetBits(long theLong, long theBits, int theStartBit, int theEndBit)
-
Method Details
-
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)
-