SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);
Boolean result = false;
int count = 0;
while(!result) {
try {
Thread.sleep(5 * 1000); //设置暂停的时间 5 秒
count ++ ;
System.out.println(new Date() + “–循环执行第” + count + “次”);
} catch (InterruptedException e) {
e.printStackTrace();
}
}