Class ArrayUtil


  • public final class ArrayUtil
    extends java.lang.Object
    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 
      Modifier Constructor Description
      private ArrayUtil()  
    • 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> 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 indexOf​(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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArrayUtil

        private ArrayUtil()
    • Method Detail

      • shortenArray

        public static byte[] shortenArray​(byte[] src,
                                          int length)
        Shortens byte array.
        Parameters:
        src - the byte array
        length - 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 array
        value - 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 array
        value - 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 array
        value - 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 array
        key - the object key
        Returns:
        the index of object