Java Memory Free freeMemoryPercents()

Here you can find the source of freeMemoryPercents()

Description

Returns percents of free memory.

License

Open Source License

Declaration

public static double freeMemoryPercents() 

Method Source Code

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

public class Main {
    /**//ww  w . ja va 2 s.co m
     * Returns percents of free memory.
     */
    public static double freeMemoryPercents() {
        Runtime runtime = Runtime.getRuntime();
        return (double) runtime.freeMemory() / runtime.totalMemory()
                * 100.0;
    }

    /**
     * Returns amount of free memory in bytes.
     */
    public static long freeMemory() {
        return Runtime.getRuntime().freeMemory();
    }

    /**
     * Returns amount of total memory in bytes.
     */
    public static long totalMemory() {
        return Runtime.getRuntime().totalMemory();
    }
}

Related

  1. freeMemory()
  2. freeMemory()
  3. freeMemory()
  4. freeMemorym()
  5. freeMemoryMB()
  6. freeReserveMemory()
  7. getFreeJVMMemoryMB()
  8. getFreeLiveMemory()
  9. getFreeMemory()