Package com.itextpdf.io.util
Class ArrayUtil
java.lang.Object
com.itextpdf.io.util.ArrayUtil
This file is a helper class for internal usage only.
Be aware that its API and functionality may be changed in the future.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int[]
cloneArray
(int[] src) Clones int array.static float[]
fillWithValue
(float[] a, float value) Fills an array with the given value.static int[]
fillWithValue
(int[] a, int value) Fills an array with the given value.static <T> void
fillWithValue
(T[] a, T value) Fills an array with the given value.static int
hashCode
(byte[] a) Creates a hash of the given byte array.static int
Gets the index of object.static byte[]
shortenArray
(byte[] src, int length) Shortens byte array.static int[]
toIntArray
(Collection<Integer> collection) Converts a collection to an int array.
-
Constructor Details
-
ArrayUtil
private ArrayUtil()
-
-
Method Details
-
shortenArray
public static byte[] shortenArray(byte[] src, int length) Shortens byte array.- Parameters:
src
- the byte arraylength
- the new length of bytes array- Returns:
- the shortened byte array
-
toIntArray
Converts a collection to an int array.- Parameters:
collection
- the collection- Returns:
- the int array
-
hashCode
public static int hashCode(byte[] a) Creates a hash of the given byte array.- Parameters:
a
- the byte array- Returns:
- the byte array
-
fillWithValue
public static int[] fillWithValue(int[] a, int value) Fills an array with the given value.- Parameters:
a
- the int arrayvalue
- the number of a value- Returns:
- the int array
-
fillWithValue
public static float[] fillWithValue(float[] a, float value) Fills an array with the given value.- Parameters:
a
- the float arrayvalue
- the number of a value- Returns:
- the float array
-
fillWithValue
public static <T> void fillWithValue(T[] a, T value) Fills an array with the given value.- Type Parameters:
T
- the type of the implementation- Parameters:
a
- the arrayvalue
- the value of type
-
cloneArray
public static int[] cloneArray(int[] src) Clones int array.- Parameters:
src
- the int array- Returns:
- the int array
-
indexOf
Gets the index of object.- Parameters:
a
- the object arraykey
- the object key- Returns:
- the index of object
-