Here you can find the source of getFilesCannotAccess(File... files)
public static List<File> getFilesCannotAccess(File... files)
//package com.java2s; import java.io.File; import java.util.ArrayList; import java.util.List; public class Main { /**//from www. ja v a 2s . c o m * Given a list of files, returns all the files which exist and that the * process can't write to. */ public static List<File> getFilesCannotAccess(File... files) { ArrayList<File> failAccess = new ArrayList<File>(); for (File file : files) { if (file.exists() && !file.canWrite()) { failAccess.add(file); } } return failAccess; } public static boolean exists(String fileName) { File file = new File(fileName); return file.exists(); } }