Java Memory Available availableMemoryPercent()

Here you can find the source of availableMemoryPercent()

Description

Returns the amount of available memory in percents.

License

Open Source License

Declaration

public static float availableMemoryPercent() 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from www .j av  a  2  s .com*/
     * Returns the amount of available memory in percents.
     */
    public static float availableMemoryPercent() {
        return availableMemory() * 100.0f / Runtime.getRuntime().maxMemory();
    }

    /**
     * Returns the amount of available memory (free memory plus never allocated memory).
     */
    public static long availableMemory() {
        return Runtime.getRuntime().freeMemory()
                + (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory());
    }
}

Related

  1. availableMemory()
  2. availableMemory()
  3. availableMemory()
  4. getAvailableMemory()
  5. getAvailableMemory()
  6. getAvailableMemory()
  7. getAvailableMemory()