Java Utililty Methods Array Size Get

List of utility methods to do Array Size Get

  1. HOME
  2. Java
  3. A
  4. Array Size Get

Description

The list of methods to do Array Size Get are organized into topic(s).

Method

int arraySize(final int expected, final float f)
array Size
final long s = Math.max(2L, nextPowerOfTwo((long) Math.ceil((double) ((float) expected / f))));
if (s > 1073741824L) {
 throw new IllegalArgumentException(
 "Too large (" + expected + " expected elements with load factor " + f + ")");
} else {
 return (int) s;
int arraySize(final int expected, final float f)
Returns the least power of two smaller than or equal to 230 and larger than or equal to Math.ceil( expected / f ).
final long s = nextPowerOfTwo((long) Math.ceil(expected / f));
if (s > (1 << 30))
 throw new IllegalArgumentException(
 "Too large (" + expected + " expected elements with load factor " + f + ")");
return (int) s;
long arraySizeOf(int[] array)
array Size Of
if (array == null)
 return 0;
return calArraySize(array.length, SIZE_OF_INT);

AltStyle によって変換されたページ (->オリジナル) /