In order to get the modifiers (public, protected, private, final, static, abstract, and interface) of a class, we can call the Class.getModifiers() method. This method returns an int value representing each modifier as a flag bit. For decoding the result, we rely on the Modifier class, as follows:
int modifiers = clazz.getModifiers();
System.out.println("Is public? "
+ Modifier.isPublic(modifiers)); // true
System.out.println("Is final? "
+ Modifier.isFinal(modifiers)); // true
System.out.println("Is abstract? "
+ Modifier.isAbstract(modifiers)); // false