Simple example:
You ll need some imports...
import java.nio.file.Path;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
String fileRoot = "";
File file = new File(fileRoot);
if (file.isFile()) {
Path path = Paths.get(fileRoot);
BasicFileAttributes attr;
try {
attr = Files.readAttributes(path, BasicFileAttributes.class);
System.out.println("creationTime = " + attr.creationTime());
System.out.println("lastAccessTime = " + attr.lastAccessTime());
System.out.println("lastModifiedTime = " + attr.lastModifiedTime());
System.out.println("isDirectory = " + attr.isDirectory());
System.out.println("isOther = " + attr.isOther());
System.out.println("isRegularFile = " + attr.isRegularFile());
System.out.println("isSymbolicLink = " + attr.isSymbolicLink());
System.out.println("size = " + attr.size());
} catch (IOException ex) {
Logger.getLogger(MGSiap.class.getName()).log(Level.SEVERE, null, ex);
}
}