Mensurar Tempo de Execução de uma rotina em Java
Table of Contents
Instant start = Instant.now();
Thread.sleep(2000); // Força uma "parada" por 2000 ms
Instant end = Instant.now();
System.out.println(Duration.between(start, end));
Instant start = Instant.now();
Thread.sleep(2000); // Força uma "parada" por 2000 ms
Instant end = Instant.now();
System.out.println(Duration.between(start, end));