Java IO Tutorial - Java FileTime.toMillis()








Syntax

FileTime.toMillis() has the following syntax.

public long toMillis()

Example

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);
        System.out.println(fileTime.toMillis());

  }
}

The code above generates the following result.