code: private static String getPID() {
          String vmName = ManagementFactory.getRuntimeMXBean().getName();
          return vmName.substring(0, vmName.indexOf("@"));
      }
docs: Returns process id. Note that Java does not guarantee any format for id,
  so this is just a common heuristic.
  
  @return Current process id