float systemUsage = 0;
float procUsage = 0;
int totalOsMemory = 0;
int freeOsRam = 0;
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
<BUG>float loadAvg = round(osBean.getSystemLoadAverage());

if (osBean instanceof com.sun.management.OperatingSystemMXBean) {</BUG>
com.sun.management.OperatingSystemMXBean sunOsBean = (com.sun.management.OperatingSystemMXBean) osBean;
<BUG>systemUsage = round(sunOsBean.getSystemCpuLoad());

procUsage = round(sunOsBean.getProcessCpuLoad());
</BUG>
totalOsMemory = byteToMega(sunOsBean.getTotalPhysicalMemorySize());

float systemUsage = 0;
float procUsage = 0;
int totalOsMemory = 0;
int freeOsRam = 0;
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
float loadAvg = round(osBean.getSystemLoadAverage(), 4);
if (loadAvg == -1) {
loadAvg = 0;
}
if (osBean instanceof com.sun.management.OperatingSystemMXBean) {
com.sun.management.OperatingSystemMXBean sunOsBean = (com.sun.management.OperatingSystemMXBean) osBean;
systemUsage = round(sunOsBean.getSystemCpuLoad() * 100, 4);
procUsage = round(sunOsBean.getProcessCpuLoad() * 100, 4);
totalOsMemory = byteToMega(sunOsBean.getTotalPhysicalMemorySize());
