public static void checkFlagsArgument ( final int requestedFlags , final int allowedFlags ) { if ( ( requestedFlags & allowedFlags ) != requestedFlags ) { throw new IllegalArgumentException ( "Requested flags 0x" + Integer . toHexString ( requestedFlags ) + ", but only 0x" + Integer . toHexString ( allowedFlags ) + " are allowed" ) ; } }
Check the requested flags throwing if any requested flags are outside the allowed set .