I am trying to run a line of code every second by using System.currentTimeMillis();.
The code:
while(true){ long var = System.currentTim
Using Thread.sleep(); would be perfect for your case.
Thread.sleep();
while(true) { Thread.sleep(1000); // Waiting before run. // Actual work goes here. }