used Memory from Runtime - Java java.lang

Java examples for java.lang:Runtime

Description

used Memory from Runtime

Demo Code


//package com.java2s;

public class Main {
    private static final Runtime rt = Runtime.getRuntime();

    public static long usedMemory() {
        return rt.totalMemory() - rt.freeMemory();
    }/*from w  w w  .j a  va2  s .  c  o  m*/
}

Related Tutorials