import java.util.Timer;
import java.util.TimerTask;
final Timer timer = new Timer();
timer.schedule(new TimerTask() {
String goalTime = "2015/11/26 09:25:00";
Long goalMsec = new Date(goalTime).getTime();
Long nowMsec = new Date().getTime();
@Override
public void run() {
nowMsec = new Date().getTime();
Long second = (goalMsec-nowMsec)/1000;
if(second < 0){
timer.cancel();
System.out.println("倒计时结束!");
}
else{
long day = second/3600/24;
Long hour = second/3600%24;
Long minute = second%3600/60;
second = second%60;
System.out.println("距离"+goalTime+",还剩"+day+"天"+hour+"小时"+minute+"分"+second+"秒");
}
}
},0,1000);