Package com.itextpdf.io.util
Class ArrayUtil
- java.lang.Object
-
- com.itextpdf.io.util.ArrayUtil
-
public final class ArrayUtil extends java.lang.ObjectThis 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 Modifier Constructor Description privateArrayUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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> voidfillWithValue(T[] a, T value)Fills an array with the given value.static inthashCode(byte[] a)Creates a hash of the given byte array.static intindexOf(java.lang.Object[] a, java.lang.Object key)Gets the index of object.static byte[]shortenArray(byte[] src, int length)Shortens byte array.static int[]toIntArray(java.util.Collection<java.lang.Integer> collection)Converts a collection to an int array.
-
-
-
Method Detail
-
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
public static int[] toIntArray(java.util.Collection<java.lang.Integer> collection)
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
public static int indexOf(java.lang.Object[] a, java.lang.Object key)Gets the index of object.- Parameters:
a- the object arraykey- the object key- Returns:
- the index of object
-
-