private static void checkAuths(Set<Integer> auths, int labelOrdinal, String identifier,
    boolean checkAuths) throws IOException {
    if (checkAuths) {
      if (auths == null || (!auths.contains(labelOrdinal))) {
        throw new AccessDeniedException("Visibility label " + identifier
          + " not authorized for the user " + VisibilityUtils.getActiveUser().getShortName());
      }
    }
  }
This will sort the passed labels in ascending oder and then will write one after the other to
the passed stream. Unsorted label ordinals Stream where to write the labels. When IOE during
writes to Stream.
hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityUtils.java