
How to sort the last modified file time in java?

import java.io.*;
import java.util.*;
import java.text.*;
public class FileModifiedDate {
public static void main(String[] args) throws IOException {
File file = new File("C:/file.txt");
if (file.exists()) {
long t = file.lastModified();
Date d = new Date(t);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
System.out.println("Last modification time : " + sdf.format(d));
} else {
System.out.println("File not found!");
}
}
}