···
package core.java.lang;
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
/**
@author DGW
@date 2017 2017年4月13日 下午8:51:19
-
@filename RuntimeClass.java
/
public class RuntimeClass {
/*- @param args
- 实际可以使用
*/
public static void main(String[] args) {
OperatingSystemMXBean opera = ManagementFactory.getOperatingSystemMXBean();
System.out.println(opera.getAvailableProcessors());
System.out.println(opera.getArch());
System.out.println(opera.getSystemLoadAverage());
Runtime runtime = Runtime.getRuntime();
//空闲内存
System.out.println(runtime.freeMemory());
//总内存
System.out.println(runtime.totalMemory());
//最大内存
System.out.println(runtime.maxMemory());
//cpu核心数
System.out.println(Runtime.getRuntime().availableProcessors());
}
}
···