title: How to dynamically monitor Java heap size?
body: <p>I am trying to monitor the java heap size dynamically. Does anybody know how to get the maximium memory used in the process of running a piece of codes? Does the <code>Runtime.maxMemory()</code> do the trick? Thanks</p>