Class NumberUtil
- java.lang.Object
-
- org.apache.ignite.internal.processors.query.stat.hll.util.NumberUtil
-
public class NumberUtil extends Object
A collection of utilities to work with numbers.
-
-
Field Summary
Fields Modifier and Type Field Description static doubleLOGE_2
-
Constructor Summary
Constructors Constructor Description NumberUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]fromHex(String string, int offset, int count)Converts the specified array of hex characters into an array ofbytes (lowbytefirst).static doublelog2(double value)Computes thelog2(log-base-two) of the specified value.static StringtoHex(byte[] bytes, int offset, int cnt)Converts the specified array ofbytes into a string of hex characters (lowbytefirst).
-
-
-
Field Detail
-
LOGE_2
public static final double LOGE_2
- See Also:
- Constant Field Values
-
-
Method Detail
-
log2
public static double log2(double value)
Computes thelog2(log-base-two) of the specified value.- Parameters:
value- thedoublefor which thelog2is desired.- Returns:
- the
log2of the specified value
-
toHex
public static String toHex(byte[] bytes, int offset, int cnt)
Converts the specified array ofbytes into a string of hex characters (lowbytefirst).- Parameters:
bytes- the array ofbytes that are to be converted. This cannot benullthough it may be empty.offset- the offset inbytesat which the bytes will be taken. This cannot be negative and must be less thanbytes.length - 1.cnt- the number of bytes to be retrieved from the specified array. This cannot be negative. If greater thanbytes.length - offsetthen that value is used.- Returns:
- a string of at most
countcharacters that represents the specified byte array in hex. This will never benullthough it may be empty ifbytesis empty orcountis zero. - Throws:
IllegalArgumentException- ifoffsetis greater than or equal tobytes.length.- See Also:
fromHex(String, int, int)
-
fromHex
public static byte[] fromHex(String string, int offset, int count)
Converts the specified array of hex characters into an array ofbytes (lowbytefirst).- Parameters:
string- the string of hex characters to be converted intobytes. This cannot benullthough it may be blank.offset- the offset in the string at which the characters will be taken. This cannot be negative and must be less thanstring.length() - 1.count- the number of characters to be retrieved from the specified string. This cannot be negative and must be divisible by two (since there are two characters perbyte).- Returns:
- the array of
bytes that were converted from the specified string (in the specified range). This will never benullthough it may be empty ifstringis empty orcountis zero. - Throws:
IllegalArgumentException- ifoffsetis greater than or equal tostring.length()or ifcountis not divisible by two.- See Also:
toHex(byte[], int, int)
-
-