code: private int processId(final java.lang.Process process) {
      int processId = 0;
      try {
        final Field f = process.getClass().getDeclaredField("pid");
        f.setAccessible(true);
  
        processId = f.getInt(process);
      } catch (final Throwable e) {
        e.printStackTrace();
      }
  
      return processId;
    }
docs: Attempt to get the process id for this process
  
  @param process The process to get the id from
  @return The id of the process