Java Array Length Get arrayLenght(Object array)

Here you can find the source of arrayLenght(Object array)

Description

array Lenght

License

Apache License

Declaration

public static int arrayLenght(Object array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int arrayLenght(Object array) {
        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;
        } else if (array instanceof float[]) {
            return ((float[]) array).length;
        } else if (array instanceof boolean[]) {
            return ((boolean[]) array).length;
        } else if (array instanceof byte[]) {
            return ((byte[]) array).length;
        } else if (array instanceof char[]) {
            return ((char[]) array).length;
        } else if (array instanceof short[]) {
            return ((short[]) array).length;
        }//from   www  .j a v  a 2s  .  c o  m
        return 0;
    }
}

Related

  1. arrayBounds(int arrayLength, int offset, int length)
  2. arrayCounter(T[] x)
  3. arrayLength(Object array, int defaultIfNull, int defaultIfNotArray)
  4. arrayLength(Object o)
  5. arrayLength(Object[] ar)
  6. length(byte[] array)