Java Memory Information getTotalMemoryStringInMb()

Here you can find the source of getTotalMemoryStringInMb()

Description

get Total Memory String In Mb

License

Apache License

Declaration

public static String getTotalMemoryStringInMb() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DecimalFormat;

public class Main {
    final static DecimalFormat memroyFormat = new DecimalFormat("#,##0.00 Mb");
    final static double MB_Numeral = 1024d * 1024d;

    public static String getTotalMemoryStringInMb() {
        return memroyFormat.format(getTotalMemoryInMb());
    }/*from w  w w  .j a v a  2s .  c  o  m*/

    public static double getTotalMemoryInMb() {
        return Runtime.getRuntime().totalMemory() / MB_Numeral;
    }
}

Related

  1. getMemoryUtilizationPercent()
  2. getNowMemoryStatus()
  3. getRuntimeMemoryStats()
  4. getRuntimeMemoryStats()
  5. getSummaryMemoryReportHeader()
  6. parseMemory(String s, int def)
  7. parseMemorySize(String arg)
  8. prettyPrintMemory(long size, boolean includeSpace)
  9. prettyPrintMemoryPerSecond(long rate)