code: private void mem(boolean gc, Console console) {
          long total = Runtime.getRuntime().totalMemory();
          long before = Runtime.getRuntime().freeMemory();
  
          console.writeLine("%-24s %12s", "Total memory", StringUtils.convertToHumanFriendlyByteSize(total));
          console.writeLine("%-24s %12s", "Used memory", StringUtils.convertToHumanFriendlyByteSize(total - before));
  
          if (gc) {
              // Let the finalizer finish its work and remove objects from its queue
              System.gc(); // asynchronous garbage collector might already run
              System.gc(); // to make sure it does a full gc call it twice
              System.runFinalization();
              try {
                  Thread.sleep(100);
              } catch (InterruptedException e) {
                  // do nothing
              }
  
              long after = Runtime.getRuntime().freeMemory();
  
              console.writeLine("%-24s %12s", "Free memory before GC", StringUtils.convertToHumanFriendlyByteSize(before));
              console.writeLine("%-24s %12s", "Free memory after GC", StringUtils.convertToHumanFriendlyByteSize(after));
              console.writeLine("%-24s %12s", "Memory gained with GC", StringUtils.convertToHumanFriendlyByteSize(after - before));
          } else {
              console.writeLine("%-24s %12s", "Free memory", StringUtils.convertToHumanFriendlyByteSize(before));
          }
      }
docs: Displays memory usage.
  
  @param gc true if performing garbage collection; false otherwise