title: How to acquire memory consumption information in Java
body: <p>I am new to Java. I want to retrieve the memory consumptions of different running Java programs. For example, I write the following program variations,</p>
  
  <pre><code>import java.util.*;
  public class HelloWorld2{
  public static void main(String[] arr){
  System.out.print(" HELLO WORLD in Java P2");
  List&lt;Integer&gt; container=new ArrayList&lt;Integer&gt;();
        for(int i=1;i&lt;=500000;i++)
   {
        container.add(i);
   };
      }
  }
  </code></pre>
  
  <p>I variate the range of i by magnitude of 10s, run the programs from command line to see how the memory consumption changes accordingly.</p>
  
  <p>But I find it difficult to see such memory consumption in the windows task list. Any ideas for me to read it from Java platform?</p>
  
  <p>Thank you indeed,</p>
  
  <p>best</p>