public static int 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");
        }

        return requestedFlags;
    }
Check the requested flags, throwing if any requested flags are outside
the allowed set.

@return the validated requested flags.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/Preconditions.java