Java Memory Available availableMemory()

Here you can find the source of availableMemory()

Description

Returns the amount of available memory (free memory plus never allocated memory).

License

Open Source License

Return

the amount of available memory, in bytes.

Declaration

public static long availableMemory() 

Method Source Code

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

public class Main {
    /** A static reference to {@link Runtime#getRuntime()}. */
    public final static Runtime RUNTIME = Runtime.getRuntime();

    /**/*from   w  ww .  ja v  a  2  s.  c  o m*/
     * Returns the amount of available memory (free memory plus never allocated memory).
     *
     * @return the amount of available memory, in bytes.
     */
    public static long availableMemory() {
        return RUNTIME.freeMemory() + RUNTIME.maxMemory() - RUNTIME.totalMemory();
    }
}

Related

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