Java -Ausführungszeit
long start = System.currentTimeMillis();
class.method();
long time = System.currentTimeMillis() - start;
Noobie Nareshhhh
long start = System.currentTimeMillis();
class.method();
long time = System.currentTimeMillis() - start;
long startTime = System.nanoTime();
methodToTime();
long endTime = System.nanoTime();
long duration = (endTime - startTime); //divide by 1000000 to get milliseconds.
long startTime = System.nanoTime();
myCall();
long stopTime = System.nanoTime();
System.out.println(stopTime - startTime);
Instant start = Instant.now();
Thread.sleep(63553);
Instant end = Instant.now();
System.out.println(Duration.between(start, end)); // prints PT1M3.553S
// import java.time.*;
Instant start = Instant.now();
// do something
Instant end = Instant.now();
System.out.println("Duration in ms: " + Duration.between(start, end).toMillis());