long start = getCurrentTime(); // This is your method that returns time in secondslong now = start;long elapsed;while (running){ now = getCurrentTime(); elapsed = now - start; System.out.println(elapsed);}