Class ArrayUtil

java.lang.Object
jj2000.j2k.util.ArrayUtil

public class ArrayUtil extends Object
This class contains a colleaction of utility static methods for arrays.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The number of elements to copy initially in an optimized array copy
    static final int
    The maximum array size to do element by element copying, larger arrays are copyied in a n optimized way.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    byteArraySet(byte[] arr, byte val)
    Reinitializes a byte array to the given value in an optimized way.
    static void
    intArraySet(int[] arr, int val)
    Reinitializes an int array to the given value in an optimized way.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAX_EL_COPYING

      public static final int MAX_EL_COPYING
      The maximum array size to do element by element copying, larger arrays are copyied in a n optimized way.
      See Also:
    • INIT_EL_COPYING

      public static final int INIT_EL_COPYING
      The number of elements to copy initially in an optimized array copy
      See Also:
  • Constructor Details

    • ArrayUtil

      public ArrayUtil()
  • Method Details

    • intArraySet

      public static void intArraySet(int[] arr, int val)
      Reinitializes an int array to the given value in an optimized way. If the length of the array is less than MAX_EL_COPYING, then the array is set element by element in the normal way, otherwise the first INIT_EL_COPYING elements are set element by element and then System.arraycopy is used to set the other parts of the array.
      Parameters:
      arr - The array to set.
      val - The value to set the array to.
    • byteArraySet

      public static void byteArraySet(byte[] arr, byte val)
      Reinitializes a byte array to the given value in an optimized way. If the length of the array is less than MAX_EL_COPYING, then the array is set element by element in the normal way, otherwise the first INIT_EL_COPYING elements are set element by element and then System.arraycopy is used to set the other parts of the array.
      Parameters:
      arr - The array to set.
      val - The value to set the array to.