The Java Doc for getModifiers() is as follows:
int getModifiers()
Returns the Java language modifiers for the member or constructor represented by this Member, as an integer. The Modifier class should be used to decode the modifiers in the integer.
and Java Docs also provide the list of different modifiers and their corresponding int values:
public static final int ABSTRACT 1024
public static final int FINAL 16
public static final int INTERFACE 512
public static final int NATIVE 256
public static final int PRIVATE 2
public static final int PROTECTED 4
public static final int PUBLIC 1
public static final int STATIC 8
public static final int STRICT 2048
public static final int SYNCHRONIZED 32
public static final int TRANSIENT 128
public static final int VOLATILE 64
For a single modifier it is very straightforward for getModifiers(). It simply returns the constant value corresponding to the modifier (e.g. when I declare one class as public final and call the getModifiers() it returns 17).
System.out.println("modifierValue:" + MyClass.class.getModifiers());
Output is:
17
However, I can't quite understand how it would work for multiple modifiers. Can anyone enlighten me?