code: String formatThreadInfo(ThreadInfo info) {
  
          StringBuilder sb = new StringBuilder(
              "\"" + info.getThreadName() + "\"" + " Id=" + info.getThreadId() + " " + info.getThreadState());
          if (info.getLockName() != null) {
              sb.append(" on " + info.getLockName());
          }
          if (info.getLockOwnerName() != null) {
              sb.append(" owned by \"" + info.getLockOwnerName() + "\" Id=" + info.getLockOwnerId());
          }
          if (info.isSuspended()) {
              sb.append(" (suspended)");
          }
          if (info.isInNative()) {
              sb.append(" (in native)");
          }
          sb.append('\n');
          int i = 0;
          for (; (i < info.getStackTrace().length); i++) {
              StackTraceElement ste = info.getStackTrace()[i];
              sb.append("\tat " + ste.toString());
              sb.append('\n');
              if ((i == 0) && (info.getLockInfo() != null)) {
                  Thread.State ts = info.getThreadState();
                  switch (ts) {
                      case BLOCKED:
                          sb.append("\t-  blocked on " + info.getLockInfo());
                          sb.append('\n');
                          break;
                      case WAITING:
                          sb.append("\t-  waiting on " + info.getLockInfo());
                          sb.append('\n');
                          break;
                      case TIMED_WAITING:
                          sb.append("\t-  waiting on " + info.getLockInfo());
                          sb.append('\n');
                          break;
                      default:
                  }
              }
  
              for (MonitorInfo mi : info.getLockedMonitors()) {
                  if (mi.getLockedStackDepth() == i) {
                      sb.append("\t-  locked " + mi);
                      sb.append('\n');
                  }
              }
          }
          return sb.toString();
  
      }
docs: Formats the thread information.<p>
  
  @param info thread information bean
  @return the formatted thread info