}
public static double getCpuUsage(long time) throws ApplicationException {
if(time<1) throw new ApplicationException("time has to be bigger than 0");
if(jsm==null) jsm=new JavaSysMon();
CpuTimes cput = jsm.cpuTimes();
if(cput==null) throw new ApplicationException("CPU information are not available for this OS");
CpuTimes previous = new CpuTimes(cput.getUserMillis(),cput.getSystemMillis(),cput.getIdleMillis());
sleep(time);
return jsm.cpuTimes().getCpuUsage(previous)*100D;
}