int (@NotNull Set<PosixFilePermission> permissions) { int mode = 0; if (permissions.contains(PosixFilePermission.OWNER_READ)) mode |= S_IRUSR; if (permissions.contains(PosixFilePermission.OWNER_WRITE)) mode |= S_IWUSR; if (permissions.contains(PosixFilePermission.OWNER_EXECUTE)) mode |= S_IXUSR; if (permissions.contains(PosixFilePermission.GROUP_READ)) mode |= S_IRGRP; if (permissions.contains(PosixFilePermission.GROUP_WRITE)) mode |= S_IWGRP; if (permissions.contains(PosixFilePermission.GROUP_EXECUTE)) mode |= S_IXGRP; if (permissions.contains(PosixFilePermission.OTHERS_READ)) mode |= S_IROTH; if (permissions.contains(PosixFilePermission.OTHERS_WRITE)) mode |= S_IWOTH; if (permissions.contains(PosixFilePermission.OTHERS_EXECUTE)) mode |= S_IXOTH; return mode; }