Arrays (Bouncy Castle Library 1.52 API Specification)
Date: 2015-03-01

org.bouncycastle.util

## Class Arrays

- java.lang.Object
- - org.bouncycastle.util.Arrays

-     public final class Arrays
      extends java.lang.Object

  General array utilities.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Arrays.Iterator<T>` Iterator backed by a specific array.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `append(byte[] a, byte b)`
    `static int[]` | `append(int[] a, int b)`
    `static short[]` | `append(short[] a, short b)`
    `static boolean` | `areEqual(boolean[] a, boolean[] b)`
    `static boolean` | `areEqual(byte[] a, byte[] b)`
    `static boolean` | `areEqual(char[] a, char[] b)`
    `static boolean` | `areEqual(int[] a, int[] b)`
    `static boolean` | `areEqual(long[] a, long[] b)`
    `static boolean` | `areEqual(java.lang.Object[] a, java.lang.Object[] b)`
    `static java.math.BigInteger[]` | `clone(java.math.BigInteger[] data)`
    `static byte[]` | `clone(byte[] data)`
    `static byte[][]` | `clone(byte[][] data)`
    `static byte[][][]` | `clone(byte[][][] data)`
    `static byte[]` | `clone(byte[] data, byte[] existing)`
    `static int[]` | `clone(int[] data)`
    `static long[]` | `clone(long[] data)`
    `static long[]` | `clone(long[] data, long[] existing)`
    `static short[]` | `clone(short[] data)`
    `static byte[]` | `concatenate(byte[] a, byte[] b)`
    `static byte[]` | `concatenate(byte[] a, byte[] b, byte[] c)`
    `static byte[]` | `concatenate(byte[] a, byte[] b, byte[] c, byte[] d)`
    `static int[]` | `concatenate(int[] a, int[] b)`
    `static boolean` | `constantTimeAreEqual(byte[] a, byte[] b)` A constant time equals comparison - does not terminate early if test will fail.
    `static boolean` | `contains(int[] a, int n)`
    `static boolean` | `contains(short[] a, short n)`
    `static java.math.BigInteger[]` | `copyOf(java.math.BigInteger[] data, int newLength)`
    `static byte[]` | `copyOf(byte[] data, int newLength)`
    `static char[]` | `copyOf(char[] data, int newLength)`
    `static int[]` | `copyOf(int[] data, int newLength)`
    `static long[]` | `copyOf(long[] data, int newLength)`
    `static java.math.BigInteger[]` | `copyOfRange(java.math.BigInteger[] data, int from, int to)`
    `static byte[]` | `copyOfRange(byte[] data, int from, int to)` Make a copy of a range of bytes from the passed in data array.
    `static int[]` | `copyOfRange(int[] data, int from, int to)`
    `static long[]` | `copyOfRange(long[] data, int from, int to)`
    `static void` | `fill(byte[] array, byte value)`
    `static void` | `fill(char[] array, char value)`
    `static void` | `fill(int[] array, int value)`
    `static void` | `fill(long[] array, long value)`
    `static void` | `fill(short[] array, short value)`
    `static int` | `hashCode(byte[] data)`
    `static int` | `hashCode(byte[] data, int off, int len)`
    `static int` | `hashCode(char[] data)`
    `static int` | `hashCode(int[] data)`
    `static int` | `hashCode(int[][] ints)`
    `static int` | `hashCode(int[] data, int off, int len)`
    `static int` | `hashCode(java.lang.Object[] data)`
    `static int` | `hashCode(short[] data)`
    `static int` | `hashCode(short[][] shorts)`
    `static int` | `hashCode(short[][][] shorts)`
    `static byte[]` | `prepend(byte[] a, byte b)`
    `static int[]` | `prepend(int[] a, int b)`
    `static short[]` | `prepend(short[] a, short b)`
    `static byte[]` | `reverse(byte[] a)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### areEqual

          public static boolean areEqual(boolean[] a,
                         boolean[] b)

    - #### areEqual

          public static boolean areEqual(char[] a,
                         char[] b)

    - #### areEqual

          public static boolean areEqual(byte[] a,
                         byte[] b)

    - #### constantTimeAreEqual

          public static boolean constantTimeAreEqual(byte[] a,
                                     byte[] b)

      A constant time equals comparison - does not terminate early if test will fail.
      Parameters:
        `a` - first array
        `b` - second array
      Returns:
        true if arrays equal, false otherwise.

    - #### areEqual

          public static boolean areEqual(int[] a,
                         int[] b)

    - #### areEqual

          public static boolean areEqual(long[] a,
                         long[] b)

    - #### areEqual

          public static boolean areEqual(java.lang.Object[] a,
                         java.lang.Object[] b)

    - #### contains

          public static boolean contains(short[] a,
                         short n)

    - #### contains

          public static boolean contains(int[] a,
                         int n)

    - #### fill

          public static void fill(byte[] array,
                  byte value)

    - #### fill

          public static void fill(char[] array,
                  char value)

    - #### fill

          public static void fill(long[] array,
                  long value)

    - #### fill

          public static void fill(short[] array,
                  short value)

    - #### fill

          public static void fill(int[] array,
                  int value)

    - #### hashCode

          public static int hashCode(byte[] data)

    - #### hashCode

          public static int hashCode(byte[] data,
                     int off,
                     int len)

    - #### hashCode

          public static int hashCode(char[] data)

    - #### hashCode

          public static int hashCode(int[][] ints)

    - #### hashCode

          public static int hashCode(int[] data)

    - #### hashCode

          public static int hashCode(int[] data,
                     int off,
                     int len)

    - #### hashCode

          public static int hashCode(short[][][] shorts)

    - #### hashCode

          public static int hashCode(short[][] shorts)

    - #### hashCode

          public static int hashCode(short[] data)

    - #### hashCode

          public static int hashCode(java.lang.Object[] data)

    - #### clone

          public static byte[] clone(byte[] data)

    - #### clone

          public static byte[] clone(byte[] data,
                     byte[] existing)

    - #### clone

          public static byte[][] clone(byte[][] data)

    - #### clone

          public static byte[][][] clone(byte[][][] data)

    - #### clone

          public static int[] clone(int[] data)

    - #### clone

          public static long[] clone(long[] data)

    - #### clone

          public static long[] clone(long[] data,
                     long[] existing)

    - #### clone

          public static short[] clone(short[] data)

    - #### clone

          public static java.math.BigInteger[] clone(java.math.BigInteger[] data)

    - #### copyOf

          public static byte[] copyOf(byte[] data,
                      int newLength)

    - #### copyOf

          public static char[] copyOf(char[] data,
                      int newLength)

    - #### copyOf

          public static int[] copyOf(int[] data,
                     int newLength)

    - #### copyOf

          public static long[] copyOf(long[] data,
                      int newLength)

    - #### copyOf

          public static java.math.BigInteger[] copyOf(java.math.BigInteger[] data,
                                      int newLength)

    - #### copyOfRange

          public static byte[] copyOfRange(byte[] data,
                           int from,
                           int to)

      Make a copy of a range of bytes from the passed in data array. The range can extend beyond the end of the input array, in which case the return array will be padded with zeroes.
      Parameters:
        `data` - the array from which the data is to be copied.
        `from` - the start index at which the copying should take place.
        `to` - the final index of the range (exclusive).
      Returns:
        a new byte array containing the range given.

    - #### copyOfRange

          public static int[] copyOfRange(int[] data,
                          int from,
                          int to)

    - #### copyOfRange

          public static long[] copyOfRange(long[] data,
                           int from,
                           int to)

    - #### copyOfRange

          public static java.math.BigInteger[] copyOfRange(java.math.BigInteger[] data,
                                           int from,
                                           int to)

    - #### append

          public static byte[] append(byte[] a,
                      byte b)

    - #### append

          public static short[] append(short[] a,
                       short b)

    - #### append

          public static int[] append(int[] a,
                     int b)

    - #### concatenate

          public static byte[] concatenate(byte[] a,
                           byte[] b)

    - #### concatenate

          public static byte[] concatenate(byte[] a,
                           byte[] b,
                           byte[] c)

    - #### concatenate

          public static byte[] concatenate(byte[] a,
                           byte[] b,
                           byte[] c,
                           byte[] d)

    - #### concatenate

          public static int[] concatenate(int[] a,
                          int[] b)

    - #### prepend

          public static byte[] prepend(byte[] a,
                       byte b)

    - #### prepend

          public static short[] prepend(short[] a,
                        short b)

    - #### prepend

          public static int[] prepend(int[] a,
                      int b)

    - #### reverse

          public static byte[] reverse(byte[] a)