Java Set Fichier Folder Permissions

//if you need rw-rw-r  permissions 
public void setPermission(File file) throws IOException{
    Set<PosixFilePermission> perms = new HashSet<>();
    perms.add(PosixFilePermission.OWNER_READ);
    perms.add(PosixFilePermission.OWNER_WRITE);

    perms.add(PosixFilePermission.OTHERS_READ);
    perms.add(PosixFilePermission.OTHERS_WRITE);

    perms.add(PosixFilePermission.GROUP_READ);

    Files.setPosixFilePermissions(file.toPath(), perms);
}
ctliv