📄 osmemoryinfo.java
字号:
package covertjava.nativecode;/** * <p>Uses a native library to obtain and print OS memory information</p> * <p>Copyright: Copyright (c) 2004 Sams Publishing</p> * @author Alex Kalinovsky * @version 1.0 */public class OSMemoryInfo { static { try { System.loadLibrary("OSMemoryInfo"); } catch (Exception x) { System.err.println("Error while loading native library OSMemoryInfo"); x.printStackTrace(System.err); System.exit(1); } } public static void main(String args[]) { System.out.println("Total Physical Memory: " + getPhysicalTotal()); System.out.println("Available Physical Memory: " + getPhysicalAvail()); System.out.println("Total Virtual Memory: " + getVirtualTotal()); System.out.println("Available Virtual Memory: " + getVirtualAvail()); } public native static long getPhysicalTotal(); public native static long getPhysicalAvail(); public native static long getVirtualTotal(); public native static long getVirtualAvail();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -