tenet.util

## 类 ByteLib

- java.lang.Object
- - tenet.util.ByteLib

-     public class ByteLib
      extends java.lang.Object

- - ### 构造器概要

    构造器
    构造器和说明
    `ByteLib()`

  - ### 方法概要

    方法
    限定符和类型 | 方法和说明
    --- | ---
    `static byte` | `byteFromUnsigned(int value, int offset)`
    `static void` | `bytesFromInt(byte[] array, int offset, int value)` Convert an int into its little-endian byte string representation.
    `static int` | `bytesToInt(byte[] array, int offset)` Convert to an int from its little-endian byte string representation.
    `static int` | `byteToUnsigned(byte value, int offset)`
    `static int` | `getBits(int value, int pos, int mask)` Returns the binary interval of original, starting at pos, masked by mask
    `static int` | `setBits(int original, int value, int pos, int mask)` Set the binary interval of original to value, starting at pos, masked by mask

    - ### 从类继承的方法 java.lang.Object

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

- - ### 构造器详细资料

    - #### ByteLib

          public ByteLib()

  - ### 方法详细资料

    - #### byteFromUnsigned

          public static byte byteFromUnsigned(int value,
                              int offset)

    - #### bytesFromInt

          public static void bytesFromInt(byte[] array,
                          int offset,
                          int value)

      Convert an int into its little-endian byte string representation.
      参数:
        `array` - the array in which to store the byte string.
        `offset` - the offset in the array where the string will start.
        `value` - the value to convert.

    - #### bytesToInt

          public static int bytesToInt(byte[] array,
                       int offset)

      Convert to an int from its little-endian byte string representation.
      参数:
        `array` - the array containing the byte string.
        `offset` - the offset of the byte string in the array.
      返回:
        the corresponding int value.

    - #### byteToUnsigned

          public static int byteToUnsigned(byte value,
                           int offset)

    - #### getBits

          public static int getBits(int value,
                    int pos,
                    int mask)

      Returns the binary interval of original, starting at pos, masked by mask
      参数:
        `value` - the original value
        `pos` - the position
        `mask` - usually (1 << length) - 1

    - #### setBits

          public static int setBits(int original,
                    int value,
                    int pos,
                    int mask)

      Set the binary interval of original to value, starting at pos, masked by mask
      参数:
        `original` - original value
        `value` - new partial value
        `pos` - the position
        `mask` - usually (1 << length) - 1
      返回:
        the new value