Java Memory Available getAvailableMemory()

Here you can find the source of getAvailableMemory()

Description

get Available Memory

License

Open Source License

Declaration

public static long getAvailableMemory() 

Method Source Code

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

public class Main {
    public static long getAvailableMemory() {
        Runtime runtime = Runtime.getRuntime();
        long maxMemory = runtime.maxMemory();
        long allocatedMemory = runtime.totalMemory();
        long freeMemory = runtime.freeMemory();
        return freeMemory + (maxMemory - allocatedMemory);
    }//from w ww  . ja v  a2  s. c  o m
}

Related

  1. availableMemory()
  2. availableMemory()
  3. availableMemory()
  4. availableMemoryPercent()
  5. getAvailableMemory()
  6. getAvailableMemory()
  7. getAvailableMemory()
  8. getAvailableMemoryFraction()
  9. getAvailableMemorySize()