org.apache.datasketches.common

## Class ByteArrayUtil

- java.lang.Object
- - org.apache.datasketches.common.ByteArrayUtil

    public final class ByteArrayUtil
    extends Object

Useful methods for byte arrays.

Author:
  Lee Rhodes

### Constructor Summary

Constructors
Constructor and Description
`ByteArrayUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `copyBytes(byte[] source, int srcStart, byte[] target, int tgtStart, int numBytes)` Copies bytes from source to target with offsets on both the source and target.
`static double` `getDoubleBE(byte[] array, int offset)` Get a double from the given byte array starting at the given offset in big endian order.
`static double` `getDoubleLE(byte[] array, int offset)` Get a double from the given byte array starting at the given offset in little endian order.
`static float` `getFloatBE(byte[] array, int offset)` Get a float from the given byte array starting at the given offset in big endian order.
`static float` `getFloatLE(byte[] array, int offset)` Get a float from the given byte array starting at the given offset in little endian order.
`static int` `getIntBE(byte[] array, int offset)` Get a int from the given byte array starting at the given offset in big endian order.
`static int` `getIntLE(byte[] array, int offset)` Get a int from the given byte array starting at the given offset in little endian order.
`static long` `getLongBE(byte[] array, int offset)` Get a long from the source byte array starting at the given offset in big endian order.
`static long` `getLongLE(byte[] array, int offset)` Get a long from the given byte array starting at the given offset in little endian order.
`static short` `getShortBE(byte[] array, int offset)` Get a short from the given byte array starting at the given offset in big endian order.
`static short` `getShortLE(byte[] array, int offset)` Get a short from the given byte array starting at the given offset in little endian order.
`static void` `putDoubleBE(byte[] array, int offset, double value)` Put the source double into the destination byte array starting at the given offset in big endian order.
`static void` `putDoubleLE(byte[] array, int offset, double value)` Put the source double into the destination byte array starting at the given offset in little endian order.
`static void` `putFloatBE(byte[] array, int offset, float value)` Put the source float into the destination byte array starting at the given offset in big endian order.
`static void` `putFloatLE(byte[] array, int offset, float value)` Put the source float into the destination byte array starting at the given offset in little endian order.
`static void` `putIntBE(byte[] array, int offset, int value)` Put the source int into the destination byte array starting at the given offset in big endian order.
`static void` `putIntLE(byte[] array, int offset, int value)` Put the source int into the destination byte array starting at the given offset in little endian order.
`static void` `putLongBE(byte[] array, int offset, long value)` Put the source long into the destination byte array starting at the given offset in big endian order.
`static void` `putLongLE(byte[] array, int offset, long value)` Put the source long into the destination byte array starting at the given offset in little endian order.
`static void` `putShortBE(byte[] array, int offset, short value)` Put the source short into the destination byte array starting at the given offset in big endian order.
`static void` `putShortLE(byte[] array, int offset, short value)` Put the source short into the destination byte array starting at the given offset in little endian order.

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

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

### Constructor Detail

#### ByteArrayUtil

    public ByteArrayUtil()

### Method Detail

#### copyBytes

    public static void copyBytes(byte[] source,
                                 int srcStart,
                                 byte[] target,
                                 int tgtStart,
                                 int numBytes)

Copies bytes from source to target with offsets on both the source and target.

Parameters:
  `source` - the given source
  `srcStart` - the source starting index
  `target` - the give target
  `tgtStart` - the target starting index
  `numBytes` - the number of bytes to be transferred.

#### getShortLE

    public static short getShortLE(byte[] array,
                                   int offset)

Get a short from the given byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source offset
Returns:
  the short

#### putShortLE

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

Put the source short into the destination byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination offset
  `value` - source short

#### getShortBE

    public static short getShortBE(byte[] array,
                                   int offset)

Get a short from the given byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source offset
Returns:
  the short

#### putShortBE

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

Put the source short into the destination byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination offset
  `value` - source short

#### getIntLE

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

Get a int from the given byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source offset
Returns:
  the int

#### putIntLE

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

Put the source int into the destination byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination offset
  `value` - source int

#### getIntBE

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

Get a int from the given byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source offset
Returns:
  the int

#### putIntBE

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

Put the source int into the destination byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination offset
  `value` - source int

#### getLongLE

    public static long getLongLE(byte[] array,
                                 int offset)

Get a long from the given byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source offset
Returns:
  the long

#### putLongLE

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

Put the source long into the destination byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination offset
  `value` - source long

#### getLongBE

    public static long getLongBE(byte[] array,
                                 int offset)

Get a long from the source byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source starting point
Returns:
  the long

#### putLongBE

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

Put the source long into the destination byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination starting point
  `value` - source long

#### getFloatLE

    public static float getFloatLE(byte[] array,
                                   int offset)

Get a float from the given byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source offset
Returns:
  the float

#### putFloatLE

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

Put the source float into the destination byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination offset
  `value` - source float

#### getFloatBE

    public static float getFloatBE(byte[] array,
                                   int offset)

Get a float from the given byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source offset
Returns:
  the float

#### putFloatBE

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

Put the source float into the destination byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination offset
  `value` - source float

#### getDoubleLE

    public static double getDoubleLE(byte[] array,
                                     int offset)

Get a double from the given byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source offset
Returns:
  the double

#### putDoubleLE

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

Put the source double into the destination byte array starting at the given offset in little endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination offset
  `value` - source double

#### getDoubleBE

    public static double getDoubleBE(byte[] array,
                                     int offset)

Get a double from the given byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - source byte array
  `offset` - source offset
Returns:
  the double

#### putDoubleBE

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

Put the source double into the destination byte array starting at the given offset in big endian order. There is no bounds checking.

Parameters:
  `array` - destination byte array
  `offset` - destination offset
  `value` - source double