public static Set<PosixFilePermission> byteToPerms(byte[] b) {

		Set<PosixFilePermission> result = EnumSet.noneOf(PosixFilePermission.class);
		// @formatter:off		
		if ((b[0] & 1)!=0)   result.add(OWNER_READ);
		if ((b[0] & 2)!=0)   result.add(OWNER_WRITE);
		if ((b[0] & 4)!=0)   result.add(OWNER_EXECUTE); 
		
		if ((b[0] & 8)!=0)   result.add(GROUP_READ);
		if ((b[0] & 16)!=0)  result.add(GROUP_WRITE);
		if ((b[0] & 32)!=0)  result.add(GROUP_EXECUTE);
		
		if ((b[0] & 64)!=0)  result.add(OTHERS_READ);
		if ((b[0] & 128)!=0) result.add(OTHERS_WRITE);
		if ((b[1] & 1)!=0)   result.add(OTHERS_EXECUTE);
		// @formatter:on

		return result;
	}