}
Collections.sort(models, new Comparator(){
@Override
public int compare(Object o1, Object o2) {
RuningTime p1=(RuningTime)o1;
RuningTime p2=(RuningTime)o2;
return (int) (p1.getStartupTime().getTime()-p2.getStartupTime().getTime());
}
});
RuningTime first=models.get(0);
RuningTime latest=models.get(models.size()-1);
LOG.debug("系统首次启动时间:"+DateTypeConverter.toDefaultDateTime(first.getStartupTime()));
LOG.debug("系统最后关闭时间:"+DateTypeConverter.toDefaultDateTime(latest.getShutdownTime()));
long totalTime=latest.getShutdownTime().getTime()-first.getStartupTime().getTime();
LOG.debug("系统总时间:"+latest.getShutdownTime().getTime()+"-"+first.getStartupTime().getTime()+"="+totalTime);
long runingTime=0;
for(RuningTime item : models){
LOG.debug(" 增加系统运行时间:"+item.getRuningTime());
runingTime+=item.getRuningTime();
}