title: Java - Converting bytes to megabytes
body: <p>I have the following code here:</p>
  
  <pre><code>long memoryUsedOnStartup = Runtime.getRuntime().totalMemory() -
  Runtime.getRuntime().freeMemory();
  </code></pre>
  
  <p>and I'm using it for some statistical stuff in my program, but this returns it in kilobytes. Is there any reliable way to convert this to megabytes?</p>
  
  <p>EDIT: It returns it in bytes, but I still need it in megabytes...</p>