DirectoryUtil { private DirectoryUtil() { } private  DirectoryUtil(); static File[] listFilesSortedByModDate(File dir);  }
@Test public void testDirectoryUtil() throws Exception { File tempDir = new File(System.getProperty("java.io.tmpdir")); File[] sortedDir = DirectoryUtil.listFilesSortedByModDate(tempDir); long prevFileMod = Long.MAX_VALUE; for (File file : sortedDir) { long fileMod = file.lastModified(); assertTrue(fileMod <= prevFileMod); prevFileMod = fileMod; } }