Here you can find the source of getMaxModifyTime(String path)
public static Timestamp getMaxModifyTime(String path)
//package com.java2s; //License from project: Apache License import java.io.File; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; public class Main { public static Timestamp getMaxModifyTime(String path) { List<String> filelist = getAllFileName(path); Timestamp time = null;/*from w w w .ja v a2s. c o m*/ for (String s : filelist) { File f = new File(s); if (time == null) { time = new Timestamp(f.lastModified()); } else { if (time.getTime() < new Timestamp(f.lastModified()).getTime()) { time = new Timestamp(f.lastModified()); } } } return time; } public static List<String> getAllFileName(String path) { File file = new File(path); File[] fileName = file.listFiles(); List<String> list = new ArrayList<>(); if (file.isDirectory()) { for (File string : fileName) if (new File(string.getPath()).isFile()) { System.out.println(string.getPath()); list.add(string.getPath()); } } else { System.out.println("it's a file."); //System.exit(1); } return list; } }