* or if it contains an unregistered privilege.
* @see #getPrivileges(int)
*/
public static int getBits(Privilege[] privileges) throws AccessControlException {
if (privileges == null || privileges.length == 0) {
throw new AccessControlException("Privilege array is empty or null.");
}
int bits = NO_PRIVILEGE;
for (Privilege priv : privileges) {
if (priv instanceof PrivilegeImpl) {
bits |= ((PrivilegeImpl) priv).internalPrivilege.getBits();
} else {
throw new AccessControlException("Unknown privilege '" + priv.getName() + "'.");
}
}
return bits;
}