Dragon? Start? =? system . current time millis(); //? Record start time
Try it? {
thread . sleep(5000); //? The thread sleeps for 5 seconds, which makes the running time not so short.
}? Catch? (Interrupt exception? e)? {
e . printstacktrace();
}
Dragon? End? =? system . current time millis(); //? Record end time
System.out.println (end-start); //? Subtract to get the running time
The unit is milliseconds.