In Java file permissions are very OS specific: *nix , NTFS (windows) and FAT/FAT32, all have different kind of file permissions. Java comes with some generic file permission to deal with it.
You can use setReadable, setWritable and setExecutable from java.io.File to set file permissions. However these methods are not always supported by the underlying filesystem.
In *nix system, you may need to configure more specifies about file permission( e.g: set a 777 permission for a file or directory), however, Java IO classes do not have ready method for it, but you can use the following dirty workaround:
Runtime.getRuntime().exec("chmod 777 file");
However, you should consider to encipher the content of your file, or use hash (e.g: md5 or sha1)
and store the fingerprint instead of the plain string:
/* store the fingerprint, not the plain string */
store = SHA1(password);// "hello world" -> "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"
/* check the password */
if (SHA1(password).equals(store))
// ok
else
// ko