public class CPUTest {
public static void main(String[] args) throws Exception {
int busyTime = 10;
int idleTime = busyTime;
long startTime = 0;
while(true){
startTime = System.currentTimeMillis();
while((System.currentTimeMillis()-startTime) <= busyTime)
;
Thread.sleep(idleTime);
}
}
}
public static void main(String[] args) throws Exception {
int busyTime = 10;
int idleTime = busyTime;
long startTime = 0;
while(true){
startTime = System.currentTimeMillis();
while((System.currentTimeMillis()-startTime) <= busyTime)
;
Thread.sleep(idleTime);
}
}
}