# Class: com.pnfsoftware.jeb.util.collect.ArrayUtil

Utility methods for arrays.

## Constructor: ArrayUtil


## Static Field: NO_BOOLEAN
Type: `boolean[]`

## Static Field: NO_BYTE
Type: `byte[]`

## Static Field: NO_CHAR
Type: `char[]`

## Static Field: NO_DOUBLE
Type: `double[]`

## Static Field: NO_FLOAT
Type: `float[]`

## Static Field: NO_INT
Type: `int[]`

## Static Field: NO_LONG
Type: `long[]`

## Static Field: NO_OBJECT
Type: `java.lang.Object[]`
Description: An empty immutable [Object\[\]](Object) array.

## Static Field: NO_SHORT
Type: `short[]`

## Static Field: NO_STRING
Type: `java.lang.String[]`
Description: An empty immutable [String\[\]](String) array.

## Static Method: asList
- parameter: `array`, type: `boolean[]`
- return type: `java.util.List<java.lang.Boolean>`

Description: A variant of [Arrays#asList(Object...)](Arrays#asList(Object...)) that accepts primitives.
parameter: array: 
return: 

## Static Method: asList
- parameter: `array`, type: `byte[]`
- return type: `java.util.List<java.lang.Byte>`

Description: A variant of [Arrays#asList(Object...)](Arrays#asList(Object...)) that accepts primitives.
parameter: array: 
return: 

## Static Method: asList
- parameter: `array`, type: `short[]`
- return type: `java.util.List<java.lang.Short>`

Description: A variant of [Arrays#asList(Object...)](Arrays#asList(Object...)) that accepts primitives.
parameter: array: 
return: 

## Static Method: asList
- parameter: `array`, type: `char[]`
- return type: `java.util.List<java.lang.Character>`

Description: A variant of [Arrays#asList(Object...)](Arrays#asList(Object...)) that accepts primitives.
parameter: array: 
return: 

## Static Method: asList
- parameter: `array`, type: `int[]`
- return type: `java.util.List<java.lang.Integer>`

Description: A variant of [Arrays#asList(Object...)](Arrays#asList(Object...)) that accepts primitives.
parameter: array: 
return: 

## Static Method: asList
- parameter: `array`, type: `long[]`
- return type: `java.util.List<java.lang.Long>`

Description: A variant of [Arrays#asList(Object...)](Arrays#asList(Object...)) that accepts primitives.
parameter: array: 
return: 

## Static Method: asList
- parameter: `array`, type: `float[]`
- return type: `java.util.List<java.lang.Float>`

Description: A variant of [Arrays#asList(Object...)](Arrays#asList(Object...)) that accepts primitives.
parameter: array: 
return: 

## Static Method: asList
- parameter: `array`, type: `double[]`
- return type: `java.util.List<java.lang.Double>`

Description: A variant of [Arrays#asList(Object...)](Arrays#asList(Object...)) that accepts primitives.
parameter: array: 
return: 

## Static Method: asView
- parameter: `a`, type: `T[]`
- return type: `java.util.List<T>`

Description: Provide a continuous read\-only view of an array.
parameter: T: 
parameter: an: array \(non\-null\)
return: a read\-only list consisting of the elements of the first array

## Static Method: asView
- parameter: `a`, type: `T[]`
- parameter: `b`, type: `T[]`
- return type: `java.util.List<T>`

Description: Provide a continuous read\-only view of two arrays.
parameter: T: 
parameter: a: first array \(non\-null\)
parameter: b: second array \(non\-null\)
return: a read\-only list consisting of the elements of the first array, followed by the         elements of the second array

## Static Method: asView
- parameter: `arrays`, type: `T[][]`
- return type: `java.util.List<T>`

Description: Provide a continuous read\-only view of an array of arrays. This method is well suited for 3\+ arrays.
parameter: T: 
parameter: arrays: the arrays
return: a read\-only list consisting of the elements of the first array, followed by the         elements of the second array, etc.

## Static Method: bytesToIntegers
- parameter: `input`, type: `byte[]`
- return type: `int[]`

Description: Convert a byte array to an int array with the same exact values \(that means the bytes are sign extended\).
parameter: input: byte array
return: int array

## Static Method: checkOffsetAndCount
- parameter: `arrayLength`, type: `int`
- parameter: `offset`, type: `int`
- parameter: `count`, type: `int`


## Static Method: compareBytes
- parameter: `array1`, type: `byte[]`
- parameter: `pos1`, type: `int`
- parameter: `array2`, type: `byte[]`
- parameter: `pos2`, type: `int`
- parameter: `size`, type: `int`
- return type: `int`

Description: Compare arrays of bytes. This method raises an [ArrayIndexOutOfBoundsException](ArrayIndexOutOfBoundsException) exception if either one of the input arrays does not contain enough bytes to be compared.
parameter: array1: first array
parameter: pos1: where to start in the first array
parameter: array2: second array
parameter: pos2: where to start in the second array
parameter: size: number of bytes to be compared
return: standard \-1/0/\+1 comparison result

## Static Method: copyBytes
- parameter: `dst`, type: `byte[]`
- parameter: `dstOffset`, type: `int`
- parameter: `src`, type: `byte[]`
- parameter: `srcOffset`, type: `int`
- parameter: `size`, type: `int`

Description: Wrapper around [Java's arraycopy\(\)](System#arraycopy(Object, int, Object, int, int)). 

 Copy bytes from a source to a destination. If the destination and source arrays are the same, potential overlaps are properly handled. This method does not validate bounds or arguments: [NullPointerException](NullPointerException) and [ArrayIndexOutOfBoundsException](ArrayIndexOutOfBoundsException) can be raised.
parameter: dst: destination array
parameter: dstOffset: start offset in the destination array
parameter: src: source array source array, potentially the same as the destination array
parameter: srcOffset: start offset in the source array
parameter: size: number of bytes to be copied

## Static Method: equalsBytes
- parameter: `array1`, type: `byte[]`
- parameter: `pos1`, type: `int`
- parameter: `array2`, type: `byte[]`
- parameter: `pos2`, type: `int`
- parameter: `size`, type: `int`
- return type: `boolean`

Description: An extended version of [Arrays#equals(boolean[], boolean[])](Arrays#equals(boolean[], boolean[])).
parameter: array1: 
parameter: pos1: 
parameter: array2: 
parameter: pos2: 
parameter: size: 
return: 

## Static Method: find
- parameter: `array`, type: `boolean[]`
- parameter: `value`, type: `boolean`
- return type: `int`


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


## Static Method: find
- parameter: `array`, type: `char[]`
- parameter: `value`, type: `char`
- return type: `int`


## Static Method: find
- parameter: `array`, type: `short[]`
- parameter: `value`, type: `short`
- return type: `int`


## Static Method: find
- parameter: `array`, type: `int[]`
- parameter: `value`, type: `int`
- return type: `int`


## Static Method: find
- parameter: `array`, type: `long[]`
- parameter: `value`, type: `long`
- return type: `int`


## Static Method: find
- parameter: `array`, type: `float[]`
- parameter: `value`, type: `float`
- return type: `int`


## Static Method: find
- parameter: `array`, type: `double[]`
- parameter: `value`, type: `double`
- return type: `int`


## Static Method: findByEquality
- parameter: `array`, type: `java.lang.Object[]`
- parameter: `value`, type: `java.lang.Object`
- return type: `int`


## Static Method: findByReference
- parameter: `array`, type: `java.lang.Object[]`
- parameter: `value`, type: `java.lang.Object`
- return type: `int`


## Static Method: getSafe
- parameter: `array`, type: `T[]`
- parameter: `index`, type: `int`
- parameter: `defaultValue`, type: `T`
- return type: `T`

Description: Retrieve a value from an array, or default value if index is out of bound or value from array is null.
parameter: T: Any [Object](Object)
parameter: array: the array
parameter: index: the index of the array
parameter: defaultValue: default value to return in case of error
return: the element of the array at the index or the default value

## Static Method: getSafe2
- parameter: `array`, type: `T[][]`
- parameter: `index`, type: `int`
- parameter: `index2`, type: `int`
- parameter: `defaultValue`, type: `T`
- return type: `T`

Description: Retrieve a value from a 2 dimension array, or default value if index is out of bound \(from any array\) or value from array is null. This is an equivalent of getSafe\(getSafe\(array, index, new T\[\]{}\), index2, default\)
parameter: T: Any [Object](Object)
parameter: array: the array
parameter: index: the index of the first array
parameter: index2: the index of the second array
parameter: defaultValue: default value to return in case of error
return: the element of the array at the index or the default value

## Static Method: getSafe3
- parameter: `array`, type: `T[][][]`
- parameter: `index`, type: `int`
- parameter: `index2`, type: `int`
- parameter: `index3`, type: `int`
- parameter: `defaultValue`, type: `T`
- return type: `T`


## Static Method: integersToBytes
- parameter: `input`, type: `int[]`
- return type: `byte[]`

Description: Convert an int array into a byte array by casting all integers to bytes.
parameter: input: int array
return: byte array

## Static Method: isSled
- parameter: `array`, type: `byte[]`
- parameter: `value`, type: `byte`
- return type: `boolean`

Description: Check if an array contains a same repeated value.
parameter: array: the array to be checked
parameter: value: the sled value
return: true if all bytes in the array are equal to the provided value

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

Description: Flip the order of an array of booleans.

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

Description: Flip the order of an array of booleans.

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

Description: Flip the order of an array of bytes.

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

Description: Flip the order of an array of bytes.

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

Description: Flip the order of an array of shorts.

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

Description: Flip the order of an array of shorts.

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

Description: Flip the order of an array of chars.

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

Description: Flip the order of an array of chars.

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

Description: Flip the order of an array of ints.

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

Description: Flip the order of an array of ints.

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

Description: Flip the order of an array of longs.

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

Description: Flip the order of an array of longs.

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

Description: Flip the order of an array of floats.

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

Description: Flip the order of an array of floats.

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

Description: Flip the order of an array of doubles.

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

Description: Flip the order of an array of doubles.

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

Description: Flip the order of an array of generic objects.

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

Description: Flip the order of an array of generic objects.

## Static Method: unsignedBytesToIntegers
- parameter: `input`, type: `byte[]`
- return type: `int[]`

Description: Convert an array of **unsigned** bytes to an array of integers.
parameter: input: byte array, for which the bytes are treated as unsigned
return: int array

