public static Set<PosixFilePermission> posixPermissionsFromInteger(final int perm) {
        Set<PosixFilePermission> result = EnumSet.noneOf(PosixFilePermission.class);
        if (isSet(perm, S_IRUSR)) {
            result.add(PosixFilePermission.OWNER_READ);
        }
        if (isSet(perm, S_IWUSR)) {
            result.add(PosixFilePermission.OWNER_WRITE);
        }
        if (isSet(perm, S_IXUSR)) {
            result.add(PosixFilePermission.OWNER_EXECUTE);
        }
        if (isSet(perm, S_IRGRP)) {
            result.add(PosixFilePermission.GROUP_READ);
        }
        if (isSet(perm, S_IWGRP)) {
            result.add(PosixFilePermission.GROUP_WRITE);
        }
        if (isSet(perm, S_IXGRP)) {
            result.add(PosixFilePermission.GROUP_EXECUTE);
        }
        if (isSet(perm, S_IROTH)) {
            result.add(PosixFilePermission.OTHERS_READ);
        }
        if (isSet(perm, S_IWOTH)) {
            result.add(PosixFilePermission.OTHERS_WRITE);
        }
        if (isSet(perm, S_IXOTH)) {
            result.add(PosixFilePermission.OTHERS_EXECUTE);
        }
        return result;
    }