Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Checks if a class is a Java type: Map, Collection,arrays, Number (extensions and primitives), String, Boolean..
     * 
     * @param clazz
     *          Class<?> to examine
     * @return true if clazz is Java type, false otherwise
     */
    public static boolean isJavaType(Class<?> clazz) {
        if (clazz.isPrimitive())
            return true;
        else if (clazz.getName().startsWith("java.lang"))
            return true;
        else if (clazz.getName().startsWith("java.util"))
            return true;
        else if (clazz.isArray())
            return true;
        return false;
    }
}