private static void writeLabelOrdinalsToStream(List<Integer> labelOrdinals, DataOutputStream dos)
    throws IOException {
    Collections.sort(labelOrdinals);
    for (Integer labelOrdinal : labelOrdinals) {
      StreamUtils.writeRawVInt32(dos, labelOrdinal);
    }
  }
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