Package org.roaringbitmap.longlong
Class IntegerUtil
- java.lang.Object
-
- org.roaringbitmap.longlong.IntegerUtil
-
public class IntegerUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description IntegerUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte
firstByte(int v)
fetch the first bytestatic int
fromBDBytes(byte[] bytes)
convert into its integer representationstatic int
setByte(int v, byte bv, int pos)
set a specified position byte to another value to return a fresh integerstatic int
shiftLeftFromSpecifiedPosition(int v, int pos, int count)
shift the byte left from the specified positionstatic byte[]
toBDBytes(int v)
convert integer to its byte array format
-
-
-
Method Detail
-
toBDBytes
public static byte[] toBDBytes(int v)
convert integer to its byte array format- Parameters:
v
- an input integer value- Returns:
- the big endian byte array representation
-
fromBDBytes
public static int fromBDBytes(byte[] bytes)
convert into its integer representation- Parameters:
bytes
- the big endian integer's byte array- Returns:
- a integer corresponding to input bytes
-
setByte
public static int setByte(int v, byte bv, int pos)
set a specified position byte to another value to return a fresh integer- Parameters:
v
- the input integer valuebv
- the byte value to replacepos
- the position of an 8 byte array to replace- Returns:
- a fresh integer after a specified position byte been replaced
-
shiftLeftFromSpecifiedPosition
public static int shiftLeftFromSpecifiedPosition(int v, int pos, int count)
shift the byte left from the specified position- Parameters:
v
- a integer valuepos
- the position from which to shift byte values leftcount
- the shifting numbers- Returns:
- a fresh integer value
-
firstByte
public static byte firstByte(int v)
fetch the first byte- Parameters:
v
- an input integer- Returns:
- the first byte of the big endian representation
-
-