public static byte[] permsToByte(Set<PosixFilePermission> perms) {

		int b1 = 0, b2 = 0;
		// @formatter:off
		if (perms.contains(OWNER_READ))		b1= (b1| 1);
		if (perms.contains(OWNER_WRITE))	b1= (b1| 2);
		if (perms.contains(OWNER_EXECUTE))	b1= (b1| 4);

		if (perms.contains(GROUP_READ))		b1= (b1| 8);
		if (perms.contains(GROUP_WRITE)) 	b1= (b1| 16);
		if (perms.contains(GROUP_EXECUTE))	b1= (b1| 32);

		if (perms.contains(OTHERS_READ))	b1= (b1| 64);
		if (perms.contains(OTHERS_WRITE))	b1= (b1| 128);
		if (perms.contains(OTHERS_EXECUTE))	b2= (b2| 1);
		// @formatter:on

		return new byte[] { (byte) b1, (byte) b2 };
	}