Question: how to calculate time of execution in java?
Answer: System. nanoTime() ...  System. currentTimeMillis() ...  Instant. now() ...  Guava's StopWatch. We can also measure elapsed time using Guava's StopWatch class instead of System. ...  Apache Commons Lang StopWatch. We can also use StopWatch API provided by Apache Commons Lang to measure execution time in milliseconds. ...  Date. getTime()