Java Memory Usage getMemoryUtiliztaion()

Here you can find the source of getMemoryUtiliztaion()

Description

get Memory Utiliztaion

License

Open Source License

Declaration

public static String getMemoryUtiliztaion() 

Method Source Code


//package com.java2s;
import java.text.DecimalFormat;

public class Main {
    private static DecimalFormat df = new DecimalFormat("#,###");

    public static String getMemoryUtiliztaion() {

        Runtime runtime = Runtime.getRuntime();

        return "heap=" + df.format(runtime.totalMemory()) + " max=" + df.format(runtime.maxMemory()) + " used="
                + df.format(runtime.totalMemory() - runtime.freeMemory()) + " free="
                + df.format(runtime.freeMemory());
    }/*  ww  w  .j a  v  a2  s .com*/
}

Related

  1. getMemoryUsage()
  2. getMemoryUsage()
  3. getMemoryUsage()
  4. getMemoryUsageSimpleHr()
  5. getMemoryUsageUnix()
  6. getMemUsage()
  7. getPercentMemoryUsage()
  8. getStringMemoryUsage(String s)
  9. getUsageMemory()