Java IO Tutorial - Java FileTime.toMillis()


FileTime.toMillis() has the following syntax.

public long toMillis()


In the following code shows how to use FileTime.toMillis() method.

/*from   w ww. j a v a 2s . c o m*/
import java.nio.file.attribute.FileTime;

public class Main {

  public static void main(String[] args) throws Exception {

    long time = System.currentTimeMillis();
    FileTime fileTime = FileTime.fromMillis(time);


The code above generates the following result.