|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.BitHelper
public class BitHelper
A collection of methods for bit-based operations.
Constructor Summary | |
---|---|
BitHelper() |
Method Summary | |
---|---|
static int |
countBits(byte b) Count the number of bits set in the passed integral value. |
static int |
countBits(int n) Count the number of bits set in the passed integral value. |
static int |
countBits(long l) Count the number of bits set in the passed integral value. |
static int |
indexOfLSB(byte b) Determine the least significant bit of the passed integral value. |
static int |
indexOfLSB(int n) Determine the least significant bit of the passed integral value. |
static int |
indexOfLSB(long l) Determine the least significant bit of the passed integral value. |
static int |
indexOfMSB(byte b) Determine the most significant bit of the passed integral value. |
static int |
indexOfMSB(int n) Determine the most significant bit of the passed integral value. |
static int |
indexOfMSB(long l) Determine the most significant bit of the passed integral value. |
static byte |
rotateLeft(byte b, int cBits) Rotate the bits of the passed byte value to the left by the number of bits specified. |
static int |
rotateLeft(int n, int cBits) Rotate the bits of the passed int value to the left by the number of bits specified. |
static long |
rotateLeft(long n, int cBits) Rotate the bits of the passed long value to the left by the number of bits specified. |
static byte |
rotateRight(byte b, int cBits) Rotate the bits of the passed byte value to the right by the number of bits specified. |
static int |
rotateRight(int n, int cBits) Rotate the bits of the passed int value to the right by the number of bits specified. |
static long |
rotateRight(long n, int cBits) Rotate the bits of the passed long value to the right by the number of bits specified. |
static java.lang.String |
toBitString(byte b) Convert a byte to a String of ones and zeros. |
static java.lang.String |
toBitString(int n) Convert an int to a String of ones and zeros. |
static java.lang.String |
toBitString(long l) Convert a long to a String of ones and zeros. |
static byte[] |
toBytes(int l) Convert the specified int into a byte array containing a series of eight bytes in big-endian form (MSB first). |
static void |
toBytes(int n, byte[] ab, int of) Convert the specified int into a series of eight bytes, and write them to the specified byte-array in big-endian form (MSB first). |
static byte[] |
toBytes(long l) Convert the specified long into a byte array containing a series of eight bytes in big-endian form (MSB first). |
static void |
toBytes(long l, byte[] ab, int of) Convert the specified long into a series of eight bytes, and write them to the specified byte-array in big-endian form (MSB first). |
static int |
toInt(byte[] ab) Return the int represented by the sequence of eight bytes (in big-endian form) in the specified byte-array. |
static int |
toInt(byte[] ab, int of) Return the int represented by the sequence of eight bytes (in big-endian form) in the specified byte-array starting at the given offset. |
static long |
toLong(byte[] ab) Return the long represented by the sequence of eight bytes (in big-endian form) in the specified byte-array. |
static long |
toLong(byte[] ab, int of) Return the long represented by the sequence of eight bytes (in big-endian form) in the specified byte-array starting at the given offset. |
Constructor Detail |
---|
public BitHelper()
Method Detail |
---|
public static byte rotateLeft(byte b, int cBits)
b
- a byte valuecBits
- the number of bit rotations to performpublic static byte rotateRight(byte b, int cBits)
b
- a byte valuecBits
- the number of bit rotations to performpublic static int rotateLeft(int n, int cBits)
n
- an int valuecBits
- the number of bit rotations to performpublic static int rotateRight(int n, int cBits)
n
- an int valuecBits
- the number of bit rotations to performpublic static long rotateLeft(long n, int cBits)
n
- a long valuecBits
- the number of bit rotations to performpublic static long rotateRight(long n, int cBits)
n
- a long valuecBits
- the number of bit rotations to performpublic static int countBits(byte b)
b
- a bytepublic static int countBits(int n)
n
- an intpublic static int countBits(long l)
l
- a longpublic static int indexOfMSB(byte b)
b
- a bytepublic static int indexOfMSB(int n)
n
- an intpublic static int indexOfMSB(long l)
l
- a longpublic static int indexOfLSB(byte b)
b
- a bytepublic static int indexOfLSB(int n)
n
- an intpublic static int indexOfLSB(long l)
l
- a longpublic static java.lang.String toBitString(byte b)
b
- a bytepublic static java.lang.String toBitString(int n)
n
- an intpublic static java.lang.String toBitString(long l)
l
- a longpublic static void toBytes(int n, byte[] ab, int of)
n
- the int to convert to bytesab
- the byte array to write intoof
- the starting offsetjava.lang.ArrayIndexOutOfBoundsException
- iff the length of the byte array is shorter than of + 4
public static byte[] toBytes(int l)
l
- the int to convert to bytespublic static void toBytes(long l, byte[] ab, int of)
l
- the long to convert to bytesab
- the byte array to write intoof
- the starting offsetjava.lang.ArrayIndexOutOfBoundsException
- iff the length of the byte array is shorter than of + 8
public static byte[] toBytes(long l)
l
- the long to convert to bytespublic static int toInt(byte[] ab, int of)
ab
- the byte-arrayof
- the offsetjava.lang.ArrayIndexOutOfBoundsException
- iff the length of the byte array is less than of + 4
public static int toInt(byte[] ab)
ab
- the byte-arrayjava.lang.ArrayIndexOutOfBoundsException
- iff the length of the byte array is less than 4
public static long toLong(byte[] ab, int of)
ab
- the byte-arrayof
- the offsetjava.lang.ArrayIndexOutOfBoundsException
- iff the length of the byte array is less than of + 8
public static long toLong(byte[] ab)
ab
- the byte-arrayjava.lang.ArrayIndexOutOfBoundsException
- iff the length of the byte array is less than 8
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |