code: public static long usedMemory() {
          long memory = 0;
          for (MemoryPoolMXBean mp : ManagementFactory.getMemoryPoolMXBeans()) {
              memory += mp.getUsage().getUsed();
          }
          return memory;
      }
docs: Represents the amount of memory currently used (in bytes).
  
  @return memory