get array Type - Android java.lang

Android examples for java.lang:array type

Description

get array Type

Demo Code


//package com.java2s;

public class Main {

    public static char getType(Object object) {
        if (isArray(object)) {
            String str = object.toString();
            return str.substring(str.lastIndexOf("[") + 1,
                    str.lastIndexOf("[") + 2).charAt(0);
        }//from  w  w w.j a v  a 2s.c  om
        return 0;
    }

    public static boolean isArray(Object object) {
        return object.getClass().isArray();
    }
}

Related Tutorials