learning java Runtime 类 获取内存及处理器核数信息

        var rt =  Runtime.getRuntime();
        System.out.println(rt.freeMemory()/(1024*1024));
        System.out.println(rt.maxMemory()/(1024*1024));
        System.out.println(rt.totalMemory()/(1024*1024));
        System.out.println(rt.availableProcessors());

output:

190
3050
192
4

  

posted @ 2019-07-25 14:52  嵌入式实操  阅读(515)  评论(0编辑  收藏  举报