com.compoze.collab.util
Class ArrayUtility

java.lang.Object
  extended by com.compoze.collab.util.ArrayUtility

public class ArrayUtility
extends Object

This class contains utility methods that operate on arrays.


Method Summary
static boolean arrayContains(Object[] array, Object obj)
          Determines if an array contains a particular object (as per its equals method).
static boolean compareArrays(Object[] array1, Object[] array2)
          Compares two object arrays for equality (they have the same length and equals for each element evaluates to true).
static boolean compareByteArrays(byte[] array1, byte[] array2)
          Compares two byte arrays for equality (that they have the same length and contents).
static int wrapByteArrayToInt(byte[] array)
          Gets an int by doing a rolling xor of bytes in the array to an int.
static void xorByteArrays(byte[] input, byte[] output)
          XOR each element of byte array into another byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

xorByteArrays

public static void xorByteArrays(byte[] input,
                                 byte[] output)
XOR each element of byte array into another byte array.

Parameters
input - the input array (not null)
output - the output array (not null)

arrayContains

public static boolean arrayContains(Object[] array,
                                    Object obj)
Determines if an array contains a particular object (as per its equals method).

Parameters
array - the array (not null but may have null elements)
obj - the object (may be null, in which case array is searched for null)

wrapByteArrayToInt

public static int wrapByteArrayToInt(byte[] array)
Gets an int by doing a rolling xor of bytes in the array to an int.

Parameters
array - the byte array (not null)
Returns
the int

compareByteArrays

public static boolean compareByteArrays(byte[] array1,
                                        byte[] array2)
Compares two byte arrays for equality (that they have the same length and contents).

Parameters
array1 - the first array (may be null)
array2 - the second array (may be null)
Returns
true if the two byte arrays have the same length and contents

compareArrays

public static boolean compareArrays(Object[] array1,
                                    Object[] array2)
Compares two object arrays for equality (they have the same length and equals for each element evaluates to true).

Parameters
array1 - the first array (may be null)
array2 - the second array (may be null)


Copyright © 2006 BEA Systems, Inc. All Rights Reserved