"There are two ways to know how much memory did your program consumes"
1.By using methods in java.lang.Runtime class
2.By using Task Manager
By using methods in java.lang.Runtime class
use this program
// save it as nani.java
class Nani
{
public void displayMemory()
{
long max=Runtime.getRuntime().maxMemory();
long total=Runtime.getRuntime().totalMemory();
long free=Runtime.getRuntime().freeMemory();
System.out.println(max/1024+" kb");
System.out.println(total/1024+" kb");
System.out.println(free/1024+" kb");
}
public static void main(String ...arg)
{
new Nani().displayMemory();
}
}
2.By using Task manager
try to find like this when your program executes