public class BitTools
extends Object
Modifier and Type  Field and Description 

static String 
VERSION
Version number of this Package (readonly).

Modifier and Type  Method and Description 

static long 
extract(byte[] value,
int pos,
int bits)
Retrieves the specified number of bits starting from position
pos, then shifts them to all the way to the right where the rightmost
bit represents the value of 1.

static long 
extract(byte[] value,
int elem,
int pos,
int bits)
Retrieves the specified number of bits starting from position
pos, then shifts them to all the way to the right where the rightmost
bit represents the value of 1.

static int 
extract(int value,
int pos,
int bits)
Retrieves the specified number of bits starting from position
pos, then shifts them to all the way to the right where the rightmost
bit represents the value of 1.

static long 
extract(long value,
int pos,
int bits)
Retrieves the specified number of bits starting from position
pos, then shifts them to all the way to the right where the rightmost
bit represents the value of 1.

public static final String VERSION
public static long extract(byte[] value, int pos, int bits)
Note: The value is treated as an unsigned long.
value
 The original number, which is in the form of a byte[] array in
the range of 0 to 8 bytes (additional bytes will be ignored), to
extract the bits frompos
 Position (0=first/rightmost bit representing a value of 1)bits
 Number of bits to extractpublic static long extract(byte[] value, int elem, int pos, int bits)
Note: The value is treated as an unsigned long.
value
 The original number, which is in the form of a byte[] array in
the range of 0 to 8 bytes (additional bytes will be ignored), to
extract the bits fromelem
 Array element to start from (first element is 0)pos
 Position (0=first/rightmost bit representing a value of 1)bits
 Number of bits to extractpublic static int extract(int value, int pos, int bits)
Note: The value is treated as an unsigned integer.
value
 The original number to extract the bits frompos
 Position (0=first/rightmost bit representing a value of 1)bits
 Number of bits to extractpublic static long extract(long value, int pos, int bits)
Note: The value is treated as an unsigned long.
value
 The original number to extract the bits frompos
 Position (0=first/rightmost bit representing a value of 1)bits
 Number of bits to extract