| java.lang.Object java.math.BitLevel
BitLevel | class BitLevel (Code) | | Static library that provides all the bit level operations for
BigInteger . The operations are:
- Left Shifting
- Right Shifting
- Bit clearing
- Bit setting
- Bit counting
- Bit testing
- Getting of the lowest bit set
All operations are provided in immutable way, and some in both mutable and
immutable.
author: Intel Middleware Product Division author: Instituto Tecnologico de Cordoba |
Method Summary | |
static int | bitCount(BigInteger val) | static int | bitLength(BigInteger val) | static BigInteger | flipBit(BigInteger val, int n) Performs a flipBit on the BigInteger, returning a BigInteger with the the
specified bit flipped. | static void | inplaceShiftLeft(BigInteger val, int count) Performs
val <<= count . | static void | inplaceShiftRight(BigInteger val, int count) Performs
val >>= count where
val is a positive number. | static boolean | nonZeroDroppedBits(int numberOfBits, int digits) | static BigInteger | shiftLeft(BigInteger source, int count) | static void | shiftLeft(int result, int source, int intCount, int count) Abstractly shifts left an array of integers in little endian (i.e. | static BigInteger | shiftRight(BigInteger source, int count) | static boolean | shiftRight(int result, int resultLen, int source, int intCount, int count) Shifts right an array of integers. | static boolean | testBit(BigInteger val, int n) Performs a fast bit testing for positive numbers. |
flipBit | static BigInteger flipBit(BigInteger val, int n)(Code) | | Performs a flipBit on the BigInteger, returning a BigInteger with the the
specified bit flipped.
intCount: the index of the element of the digits array where the operation will be performed bitNumber: the bit's position in the intCount element |
inplaceShiftLeft | static void inplaceShiftLeft(BigInteger val, int count)(Code) | | Performs
val <<= count .
|
inplaceShiftRight | static void inplaceShiftRight(BigInteger val, int count)(Code) | | Performs
val >>= count where
val is a positive number.
|
nonZeroDroppedBits | static boolean nonZeroDroppedBits(int numberOfBits, int digits)(Code) | | Check if there are 1s in the lowest bits of this BigInteger
Parameters: numberOfBits - the number of the lowest bits to check false if all bits are 0s, true otherwise |
shiftLeft | static void shiftLeft(int result, int source, int intCount, int count)(Code) | | Abstractly shifts left an array of integers in little endian (i.e. shift
it right). Total shift distance in bits is intCount * 32 + count
Parameters: result - the destination array Parameters: source - the source array Parameters: intCount - the shift distance in integers Parameters: count - an additional shift distance in bits |
shiftRight | static boolean shiftRight(int result, int resultLen, int source, int intCount, int count)(Code) | | Shifts right an array of integers. Total shift distance in bits is
intCount * 32 + count.
Parameters: result - the destination array Parameters: resultLen - the destination array's length Parameters: source - the source array Parameters: intCount - the number of elements to be shifted Parameters: count - the number of bits to be shifted dropped bit's are all zero (i.e. remaider is zero) |
testBit | static boolean testBit(BigInteger val, int n)(Code) | | Performs a fast bit testing for positive numbers. The bit to to be tested
must be in the range
[0, val.bitLength()-1] |
|
|