# Class: com.pnfsoftware.jeb.util.io.EndianUtil

Byte array to/from primitives with endianness support.

## Constructor: EndianUtil


## Static Method: bigEndianBytesToInt
- parameter: `array`, type: `byte[]`
- return type: `int`


## Static Method: bigEndianBytesToInt
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- return type: `int`


## Static Method: bigEndianBytesToLong
- parameter: `array`, type: `byte[]`
- return type: `long`


## Static Method: bigEndianBytesToLong
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- return type: `long`


## Static Method: bigEndianBytesToShort
- parameter: `array`, type: `byte[]`
- return type: `short`


## Static Method: bigEndianBytesToShort
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- return type: `short`


## Static Method: bytesToInt
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `order`, type: `java.nio.ByteOrder`
- return type: `int`

Description: Read 4 bytes and convert it to an integer.
parameter: array: input buffer
parameter: offset: buffer offset
parameter: order: endianness
return: 

## Static Method: bytesToLong
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `order`, type: `java.nio.ByteOrder`
- return type: `long`

Description: Read 8 bytes and convert it to a long.
parameter: array: input buffer
parameter: offset: buffer offset
parameter: order: endianness
return: 

## Static Method: bytesToNumberSigned
- parameter: `bo`, type: `java.nio.ByteOrder`
- parameter: `b`, type: `byte[]`
- return type: `long`

Description: Convert a byte array to a number, sign is extended to long, meaning that {0x88} will result in 0xFFFFFFFF\_FFFFFF88L

## Static Method: bytesToNumberUnsigned
- parameter: `bo`, type: `java.nio.ByteOrder`
- parameter: `b`, type: `byte[]`
- return type: `long`

Description: Convert a byte array to a number, zero extended to long, meaning that {0x88} will result in 0x88L

## Static Method: bytesToShort
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `order`, type: `java.nio.ByteOrder`
- return type: `short`

Description: Read 2 bytes and convert it to a short.
parameter: array: input buffer
parameter: offset: buffer offset
parameter: order: endianness
return: 

## Static Method: intToBEBytes
- parameter: `v`, type: `int`
- return type: `byte[]`

Description: Convert a 32\-bit integer to a big\-endian encoded array of bytes.
parameter: v: 
return: 

## Static Method: intToBEBytes
- parameter: `v`, type: `int`
- parameter: `output`, type: `byte[]`


## Static Method: intToBEBytes
- parameter: `v`, type: `int`
- parameter: `output`, type: `byte[]`
- parameter: `offset`, type: `int`


## Static Method: intToLEBytes
- parameter: `v`, type: `int`
- return type: `byte[]`

Description: Convert a 32\-bit integer to a little\-endian encoded array of bytes.
parameter: v: 
return: 

## Static Method: intToLEBytes
- parameter: `v`, type: `int`
- parameter: `output`, type: `byte[]`


## Static Method: intToLEBytes
- parameter: `v`, type: `int`
- parameter: `output`, type: `byte[]`
- parameter: `offset`, type: `int`


## Static Method: littleEndianBytesToInt
- parameter: `array`, type: `byte[]`
- return type: `int`


## Static Method: littleEndianBytesToInt
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- return type: `int`


## Static Method: littleEndianBytesToLong
- parameter: `array`, type: `byte[]`
- return type: `long`


## Static Method: littleEndianBytesToLong
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- return type: `long`


## Static Method: littleEndianBytesToShort
- parameter: `array`, type: `byte[]`
- return type: `short`


## Static Method: littleEndianBytesToShort
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- return type: `short`


## Static Method: longToBEBytes
- parameter: `v`, type: `long`
- return type: `byte[]`

Description: Convert a 64\-bit integer to a big\-endian encoded array of bytes.
parameter: v: 
return: 

## Static Method: longToBEBytes
- parameter: `v`, type: `long`
- parameter: `output`, type: `byte[]`


## Static Method: longToBEBytes
- parameter: `v`, type: `long`
- parameter: `output`, type: `byte[]`
- parameter: `offset`, type: `int`


## Static Method: longToLEBytes
- parameter: `v`, type: `long`
- return type: `byte[]`

Description: Convert a 64\-bit integer to a little\-endian encoded array of bytes.
parameter: v: 
return: 

## Static Method: longToLEBytes
- parameter: `v`, type: `long`
- parameter: `output`, type: `byte[]`


## Static Method: longToLEBytes
- parameter: `v`, type: `long`
- parameter: `output`, type: `byte[]`
- parameter: `offset`, type: `int`


## Static Method: numberToBytes
- parameter: `bo`, type: `java.nio.ByteOrder`
- parameter: `v`, type: `long`
- parameter: `output`, type: `byte[]`

Description: Automatically convert a value depending on the byte array size. If size if not a pow of two, the floor pow of two is filled \(for example is size is 5, value will be considered as integer\). byte\[\] of more than 8 bytes will be cropped. This function is a bridge to xxxToLEBytes and xxxToBEBytes functions.
parameter: bo: byteOrder to use for output value
parameter: v: input value
parameter: output: output representation of v, using the given ByteOrder

## Static Method: shortToBEBytes
- parameter: `v`, type: `short`
- return type: `byte[]`

Description: Convert a 16\-bit integer to a big\-endian encoded array of bytes.
parameter: v: 
return: 

## Static Method: shortToBEBytes
- parameter: `v`, type: `short`
- parameter: `output`, type: `byte[]`


## Static Method: shortToBEBytes
- parameter: `v`, type: `short`
- parameter: `output`, type: `byte[]`
- parameter: `offset`, type: `int`


## Static Method: shortToLEBytes
- parameter: `v`, type: `short`
- return type: `byte[]`

Description: Convert a 16\-bit integer to a little\-endian encoded array of bytes.
parameter: v: 
return: 

## Static Method: shortToLEBytes
- parameter: `v`, type: `short`
- parameter: `output`, type: `byte[]`


## Static Method: shortToLEBytes
- parameter: `v`, type: `short`
- parameter: `output`, type: `byte[]`
- parameter: `offset`, type: `int`


## Static Method: swap
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `size`, type: `int`

Description: Flip the byte order of an array of bytes. This method does not create a new array.
parameter: array: the input/output array
parameter: offset: start index
parameter: size: number of elements to flip

## Static Method: swap
- parameter: `array`, type: `byte[]`

Description: Flip the byte order of an array of bytes. This method does not create a new array.
parameter: array: the input/output array

## Static Method: swapByGroup
- parameter: `array`, type: `byte[]`
- parameter: `grpByteCount`, type: `int`

Description: Flip the byte order of groups of bytes. This method does not create a new array.
parameter: array: byte array to change
parameter: grpByteCount: number of bytes per group \(2 for 16 bits, 4 for 32 bits, 8 for 64 bits\)

## Static Method: swapInt
- parameter: `v`, type: `int`
- return type: `int`

Description: Swap the byte ordering of an int.
parameter: v: 
return: 

## Static Method: swapLong
- parameter: `v`, type: `long`
- return type: `long`

Description: Swap the byte ordering of a long.
parameter: v: 
return: 

## Static Method: swapShort
- parameter: `v`, type: `short`
- return type: `short`

Description: Swap the byte ordering of a short.
parameter: v: 
return: 

