code: public static int getPID() {
          if (pid == -1) {
              RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();
              String name = mx.getName();
              String token = name.split("@")[0];
              pid = parseInt(token);
          }
          return pid;
      }
docs: Returns the virtual machine's process identifier.
  
  @return {@code int}