Answers for "measure execution time java"

3

java time code

final long startTime = System.currentTimeMillis();
for (int i = 0; i < length; i++) {
  // Do something
}
final long endTime = System.currentTimeMillis();

System.out.println("Total execution time: " + (endTime - startTime));
Posted by: Guest on April-21-2020
1

java execution time

long start = System.currentTimeMillis();
class.method();
long time = System.currentTimeMillis() - start;
Posted by: Guest on January-15-2021
2

java measure execution time

Instant start = Instant.now();
Thread.sleep(63553);
Instant end = Instant.now();
System.out.println(Duration.between(start, end)); // prints PT1M3.553S
Posted by: Guest on October-24-2020

Code answers related to "measure execution time java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language