boolean isPublic = Modifier.isPublic(MyClass.class.getModifiers());
boolean isStatic = Modifier.isStatic(MyClass.class.getMethod("myMethod").getModifiers());
boolean isFinal = Modifier.isFinal(MyClass.class.getField("myField").getModifiers());These examples demonstrate the use of the Modifier class to determine whether a class, method, or field has a specific modifier. The package library for this class is java.lang.reflect.