Here you can find the source of isAssignableFrom(Class> to, Class> from)
public static boolean isAssignableFrom(Class<?> to, Class<?> from)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.Map; public class Main { /** A map of the primitive types to their wrapper types */ private static final Map<Class<?>, Class<?>> PRIMITIVE_TO_WRAPPER = new HashMap<>(); /**//from www .ja v a 2 s . co m * Just like Class.isAssignableFrom(), but does the right thing when considering autoboxing. */ public static boolean isAssignableFrom(Class<?> to, Class<?> from) { Class<?> notPrimitiveTo = to.isPrimitive() ? PRIMITIVE_TO_WRAPPER.get(to) : to; Class<?> notPrimitiveFrom = from.isPrimitive() ? PRIMITIVE_TO_WRAPPER.get(from) : from; return notPrimitiveTo.isAssignableFrom(notPrimitiveFrom); } }