code: public static int convertToInt(final Set<PosixFilePermission> aPermSet) {
          int result = 0;
  
          if (aPermSet.contains(PosixFilePermission.OWNER_READ)) {
              result = result | 0400;
          }
  
          if (aPermSet.contains(PosixFilePermission.OWNER_WRITE)) {
              result = result | 0200;
          }
  
          if (aPermSet.contains(PosixFilePermission.OWNER_EXECUTE)) {
              result = result | 0100;
          }
  
          if (aPermSet.contains(PosixFilePermission.GROUP_READ)) {
              result = result | 040;
          }
  
          if (aPermSet.contains(PosixFilePermission.GROUP_WRITE)) {
              result = result | 020;
          }
  
          if (aPermSet.contains(PosixFilePermission.GROUP_EXECUTE)) {
              result = result | 010;
          }
  
          if (aPermSet.contains(PosixFilePermission.OTHERS_READ)) {
              result = result | 04;
          }
  
          if (aPermSet.contains(PosixFilePermission.OTHERS_WRITE)) {
              result = result | 02;
          }
  
          if (aPermSet.contains(PosixFilePermission.OTHERS_EXECUTE)) {
              result = result | 01;
          }
  
          return result;
      }
docs: Convert a PosixFilePermission set to an integer permissions mode.
  
  @param aPermSet A PosixFilePermission set
  @return A permissions mode integer