Here you can find the source of getPosixPermissionsAsInt( Set
public static int getPosixPermissionsAsInt( Set<PosixFilePermission> permissionSet)
//package com.java2s; import java.nio.file.attribute.PosixFilePermission; import java.util.Set; public class Main { private static final int O400 = 256; private static final int O200 = 128; private static final int O100 = 64; private static final int O040 = 32; private static final int O020 = 16; private static final int O010 = 8; private static final int O004 = 4; private static final int O002 = 2; private static final int O001 = 1; public static int getPosixPermissionsAsInt( Set<PosixFilePermission> permissionSet) { int result = 0; if (permissionSet.contains(PosixFilePermission.OWNER_READ)) { result = result | O400;// w w w . j a v a 2 s. c o m } if (permissionSet.contains(PosixFilePermission.OWNER_WRITE)) { result = result | O200; } if (permissionSet.contains(PosixFilePermission.OWNER_EXECUTE)) { result = result | O100; } if (permissionSet.contains(PosixFilePermission.GROUP_READ)) { result = result | O040; } if (permissionSet.contains(PosixFilePermission.GROUP_WRITE)) { result = result | O020; } if (permissionSet.contains(PosixFilePermission.GROUP_EXECUTE)) { result = result | O010; } if (permissionSet.contains(PosixFilePermission.OTHERS_READ)) { result = result | O004; } if (permissionSet.contains(PosixFilePermission.OTHERS_WRITE)) { result = result | O002; } if (permissionSet.contains(PosixFilePermission.OTHERS_EXECUTE)) { result = result | O001; } return result; } }