danger.util
Class ArrayUtils

java.lang.Object
  extended by danger.util.ArrayUtils


public final class ArrayUtils
extends Object

Generic array utilities.


Method Summary
static int idealByteArrayLength(int minSize)
          Return the "ideal length" for a byte[] that must be at least the given number of elements in length.
static int idealCharArrayLength(int minSize)
          Return the "ideal length" for a char[] that must be at least the given number of elements in length.
static int idealIntArrayLength(int minSize)
          Return the "ideal length" for an int[] that must be at least the given number of elements in length.
static int idealLongArrayLength(int minSize)
          Return the "ideal length" for a long[] that must be at least the given number of elements in length.
static int idealObjectArrayLength(int minSize)
          Return the "ideal length" for an Object[] (or subclass thereof) that must be at least the given number of elements in length.
static int idealShortArrayLength(int minSize)
          Return the "ideal length" for a short[] that must be at least the given number of elements in length.
static int lowerIdealByteArrayLength(int minSize)
          Return the portion of a byte[] of the specified size that would fit into an ideal-sized array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

idealByteArrayLength

public static int idealByteArrayLength(int minSize)
Return the "ideal length" for a byte[] that must be at least the given number of elements in length. This takes into account the underlying allocation strategy.

Parameters:
minSize - the minimum length of the array
Returns:
the ideal length for the array

idealCharArrayLength

public static int idealCharArrayLength(int minSize)
Return the "ideal length" for a char[] that must be at least the given number of elements in length. This takes into account the underlying allocation strategy.

Parameters:
minSize - the minimum length of the array
Returns:
the ideal length for the array

idealShortArrayLength

public static int idealShortArrayLength(int minSize)
Return the "ideal length" for a short[] that must be at least the given number of elements in length. This takes into account the underlying allocation strategy.

Parameters:
minSize - the minimum length of the array
Returns:
the ideal length for the array

idealIntArrayLength

public static int idealIntArrayLength(int minSize)
Return the "ideal length" for an int[] that must be at least the given number of elements in length. This takes into account the underlying allocation strategy.

Parameters:
minSize - the minimum length of the array
Returns:
the ideal length for the array

idealLongArrayLength

public static int idealLongArrayLength(int minSize)
Return the "ideal length" for a long[] that must be at least the given number of elements in length. This takes into account the underlying allocation strategy.

Parameters:
minSize - the minimum length of the array
Returns:
the ideal length for the array

idealObjectArrayLength

public static int idealObjectArrayLength(int minSize)
Return the "ideal length" for an Object[] (or subclass thereof) that must be at least the given number of elements in length. This takes into account the underlying allocation strategy.

Parameters:
minSize - the minimum length of the array
Returns:
the ideal length for the array

lowerIdealByteArrayLength

public static int lowerIdealByteArrayLength(int minSize)
Return the portion of a byte[] of the specified size that would fit into an ideal-sized array.

Parameters:
minSize - the preferred length of the array
Returns:
the length for the array that would fit