package ethanjones.cubes.core.system;

public class Memory {

  public static volatile int max;
  public static volatile int allocated;
  public static volatile int free;
  public static volatile int totalFree;
  public static volatile int used;
  public static final String unit = "MB";
  private static final int divideMB = 1048576; //1024 * 1024. Divide to get MB

  static {
    update();
  }

  public synchronized static void update() {
    Runtime runtime = Runtime.getRuntime();

    max = (int) runtime.maxMemory() / divideMB;
    allocated = (int) runtime.totalMemory() / divideMB;
    free = (int) runtime.freeMemory() / divideMB;
    totalFree = free + (max - allocated);
    used = max - totalFree;
  }
}

@@ -489,32 +489,33 @@
     max = (int) 
+(
 runtime.maxMemor
@@ -524,24 +524,25 @@
 ) / divideMB
+)
 ;%0A    alloca
@@ -545,32 +545,33 @@
 located = (int) 
+(
 runtime.totalMem
@@ -582,24 +582,25 @@
 ) / divideMB
+)
 ;%0A    free =
@@ -606,16 +606,17 @@
 = (int) 
+(
 runtime.
@@ -638,16 +638,17 @@
 divideMB
+)
 ;%0A    to
@@ -698,20 +698,21 @@
 d = 
-max - totalF
+allocated - f
 ree;

Fix Memory