code: private Thread getStuckThread(Thread mainThread) {
          List<Thread> threadsInGroup = getThreadsInGroup(mainThread.getThreadGroup());
          if (threadsInGroup.isEmpty()) {
              return null;
          }
  
          // Now that we have all the threads in the test's thread group: Assume that
          // any thread we're "stuck" in is RUNNABLE.  Look for all RUNNABLE threads. 
          // If just one, we return that (unless it equals threadMain).  If there's more
          // than one, pick the one that's using the most CPU time, if this feature is
          // supported.
          Thread stuckThread = null;
          long maxCpuTime = 0;
          for (Thread thread : threadsInGroup) {
              if (thread.getState() == Thread.State.RUNNABLE) {
                  long threadCpuTime = cpuTime(thread);
                  if (stuckThread == null || threadCpuTime > maxCpuTime) {
                      stuckThread = thread;
                      maxCpuTime = threadCpuTime;
                  }
              }               
          }
          return (stuckThread == mainThread) ? null : stuckThread;
      }
docs: Determines whether the test appears to be stuck in some thread other than
  the "main thread" (the one created to run the test).  This feature is experimental.
  Behavior may change after the 4.12 release in response to feedback.
  @param mainThread The main thread created by {@code evaluate()}
  @return The thread which appears to be causing the problem, if different from
  {@code mainThread}, or {@code null} if the main thread appears to be the
  problem or if the thread cannot be determined.  The return value is never equal
  to {@code mainThread}.