maxMemory() returns the maximum amount of memory that java will use. So That will not get you what you want. totalMemory() is what you are looking for though. See The docs
maxMemory() returns the maximum amount of memory that java will use. So That will not get you what you want. totalMemory() is what you are looking for though. See The docs