Here you can find the source of chmod(final int mode, final File path)
public static void chmod(final int mode, final File path)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.io.File; import java.nio.file.Path; public class Main { public static void chmod(final int mode, final Path path) { // TODO(dborowitz): Is there a portable way to do this with NIO? chmod(mode, path.toFile());// ww w . ja v a 2s. c om } public static void chmod(final int mode, final File path) { path.setReadable(false, false /* all */); path.setWritable(false, false /* all */); path.setExecutable(false, false /* all */); path.setReadable((mode & 0400) == 0400, true /* owner only */); path.setWritable((mode & 0200) == 0200, true /* owner only */); if (path.isDirectory() || (mode & 0100) == 0100) { path.setExecutable(true, true /* owner only */); } if ((mode & 0044) == 0044) { path.setReadable(true, false /* all */); } if ((mode & 0011) == 0011) { path.setExecutable(true, false /* all */); } } }