org.apache.ignite.internal.processors.query.stat.hll.util

## 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
`static double` `LOGE_2`

### Constructor Summary

Constructors
Constructor and Description
`NumberUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static byte[]` `fromHex(String string, int offset, int count)` Converts the specified array of hex characters into an array of `byte`s (low `byte` first).
`static double` `log2(double value)` Computes the `log2` (log-base-two) of the specified value.
`static String` `toHex(byte[] bytes, int offset, int cnt)` Converts the specified array of `byte`s into a string of hex characters (low `byte` first).

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### LOGE_2

    public static final double LOGE_2

See Also:
  Constant Field Values

### Constructor Detail

#### NumberUtil

    public NumberUtil()

### Method Detail

#### log2

    public static double log2(double value)

Computes the `log2` (log-base-two) of the specified value.

Parameters:
  `value` - the `double` for which the `log2` is desired.
Returns:
  the `log2` of the specified value

#### toHex

    public static String toHex(byte[] bytes,
                               int offset,
                               int cnt)

Converts the specified array of `byte`s into a string of hex characters (low `byte` first).

Parameters:
  `bytes` - the array of `byte`s that are to be converted. This cannot be `null` though it may be empty.
  `offset` - the offset in `bytes` at which the bytes will be taken. This cannot be negative and must be less than `bytes.length - 1`.
  `cnt` - the number of bytes to be retrieved from the specified array. This cannot be negative. If greater than `bytes.length - offset` then that value is used.
Returns:
  a string of at most `count` characters that represents the specified byte array in hex. This will never be `null` though it may be empty if `bytes` is empty or `count` is zero.
Throws:
  `IllegalArgumentException` - if `offset` is greater than or equal to `bytes.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 of `byte`s (low `byte` first).

Parameters:
  `string` - the string of hex characters to be converted into `byte`s. This cannot be `null` though 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 than `string.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 per `byte`).
Returns:
  the array of `byte`s that were converted from the specified string (in the specified range). This will never be `null` though it may be empty if `string` is empty or `count` is zero.
Throws:
  `IllegalArgumentException` - if `offset` is greater than or equal to `string.length()` or if `count` is not divisible by two.
See Also:
  `toHex(byte[], int, int)`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023