code: public int activeCount() {
          int result;
          // Snapshot sub-group data so we don't hold this lock
          // while our children are computing.
          int ngroupsSnapshot;
          ThreadGroup[] groupsSnapshot;
          synchronized (this) {
              if (destroyed) {
                  return 0;
              }
              result = nthreads;
              ngroupsSnapshot = ngroups;
              if (groups != null) {
                  groupsSnapshot = Arrays.copyOf(groups, ngroupsSnapshot);
              } else {
                  groupsSnapshot = null;
              }
          }
          for (int i = 0 ; i < ngroupsSnapshot ; i++) {
              result += groupsSnapshot[i].activeCount();
          }
          return result;
      }
docs: Returns an estimate of the number of active threads in this thread
  group and its subgroups. Recursively iterates over all subgroups in
  this thread group.
  
  <p> The value returned is only an estimate because the number of
  threads may change dynamically while this method traverses internal
  data structures, and might be affected by the presence of certain
  system threads. This method is intended primarily for debugging
  and monitoring purposes.
  
  @return  an estimate of the number of active threads in this thread
  group and in any other thread group that has this thread
  group as an ancestor
  
  @since   JDK1.0