Java Memory Usage getMemInfo()

Here you can find the source of getMemInfo()

Description

get Mem Info

License

Open Source License

Declaration

public static String getMemInfo() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.NumberFormat;

import java.util.Locale;

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

    public static String getMemInfo() {
        NumberFormat format = NumberFormat.getInstance(Locale.ITALIAN);
        StringBuilder sb = new StringBuilder();
        long allocatedMemory = runtime.totalMemory();
        sb.append(format.format(allocatedMemory / 1024 / 1024)).append(" MB");
        return sb.toString();

    }//from   www  . jav a 2s  .  c  om
}

Related

  1. describeMemoryUsage()
  2. estimateMemoryUsage(String s)
  3. getMemberName(int number)
  4. getMemoryFootprint()
  5. getMemoryInfo()
  6. getMemoryInfo()
  7. getMemoryInfo()