Java Utililty Methods Array Length Get

List of utility methods to do Array Length Get

Description

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

Method

voidarrayBounds(int arrayLength, int offset, int length)
array Bounds
if (offset < 0 || length < 0 || length > arrayLength - offset) {
    throw new IndexOutOfBoundsException(
            "array.length=" + arrayLength + ", offset=" + offset + ", length=" + length);
intarrayCounter(T[] x)
array Counter
int z = 0;
for (int i = 0; i < x.length; i++) {
    T y = x[i];
    if (y != null) {
        z++;
return z;
...
intarrayLenght(Object array)
array Lenght
if (array instanceof Object[]) {
    return ((Object[]) array).length;
} else if (array instanceof int[]) {
    return ((int[]) array).length;
} else if (array instanceof long[]) {
    return ((long[]) array).length;
} else if (array instanceof double[]) {
    return ((double[]) array).length;
...
intarrayLength(Object array, int defaultIfNull, int defaultIfNotArray)
array Length
if (array == null) {
    return defaultIfNull; 
} else if (array instanceof Object[]) {
    return ((Object[]) array).length;
} else if (array instanceof long[]) {
    return ((long[]) array).length;
} else if (array instanceof int[]) {
    return ((int[]) array).length;
...
intarrayLength(Object o)
array Length
if (o instanceof Object[])
    return ((Object[]) o).length;
else if (o instanceof boolean[])
    return ((boolean[]) o).length;
else if (o instanceof float[])
    return ((float[]) o).length;
else if (o instanceof double[])
    return ((double[]) o).length;
...
intarrayLength(Object[] ar)
array Length
return ar.length;
intlength(byte[] array)
length
return (array == null ? 0 : array.length);
Stringlength(byte[] array)
length
return "(" + array.length + " B)";
doublelength(double[] a)
length
double c = 0;
for (int i = 0; i < a.length; i++)
    c += a[i] * a[i];
return Math.sqrt(c);
doublelength(double[] point)
length
return Math.sqrt(stScalarProd(point, point));