long inicio = System.currentTimeMillis(); Thread.sleep(2000); long fin = System.currentTimeMillis(); double tiempo = (double) ((fin - inicio)/1000);