Этот метод также проверяет, является ли это оболочкой примитивного типа:
/**
* Checks first whether it is primitive and then whether it's wrapper is a primitive wrapper. Returns true
* if either is true
*
* @param c
* @return whether it's a primitive type itself or it's a wrapper for a primitive type
*/
public static boolean isPrimitive(Class c) {
if (c.isPrimitive()) {
return true;
} else if (c == Byte.class
|| c == Short.class
|| c == Integer.class
|| c == Long.class
|| c == Float.class
|| c == Double.class
|| c == Boolean.class
|| c == Character.class) {
return true;
} else {
return false;
}