Check if directory is emptyBecause having something like Directory.isEmpty() would be too obvious. File dir = new File("path/to/my/file"); boolean isEmpty = file.isDirectory() && file.list().length == 0 Create a Path to Nonexistent Temporary fileThis is an interesting task. I needed to create a path to a temporary zip archive that did not exist yet so that I could use a zip4j library. It is easy to create a temporary file. 1 File tempFile = File.