Usage:
Can be used to get the current time of the number of milliseconds, the number of milliseconds can be compared by time, time conversion and time formatting and so on.
public class SystemTime {
public static void Main (string[] args) {
Defining the time variables that were running
Long time = System.currenttimemillis ();
The number of milliseconds to print the start time
System.out.println (time);
for (int i =0;i<10000;i++) {
You don't have to do anything.
}
System.out.println (the time required for the For Loop to run (in milliseconds) + (System.currenttimemillis ()-time));
System.out.println ("For Loop run time required (seconds)" + (System.currenttimemillis ()-time)/1000);
System.out.println ("Show Current Time:" +new simpledateformat ("Yyyy-mm-dd HH:mm:ss"). Format (System.currenttimemillis ()));
}
}
Meaning:
The primary is to return the current time in milliseconds, and the granularity of the value depends on the different operating systems:
Usage and meaning of Currenttimemillis in Java.