code: protected void addIndexContents(PackageDoc[] packages, String text,
              String tableSummary, Content body) {
          if (packages.length > 0) {
              Arrays.sort(packages);
              HtmlTree div = new HtmlTree(HtmlTag.DIV);
              div.addStyle(HtmlStyle.indexHeader);
              addAllClassesLink(div);
              if (configuration.showProfiles) {
                  addAllProfilesLink(div);
              }
              body.addContent(div);
              if (configuration.showProfiles && configuration.profilePackages.size() > 0) {
                  Content profileSummary = configuration.getResource("doclet.Profiles");
                  addProfilesList(profileSummary, body);
              }
              addPackagesList(packages, text, tableSummary, body);
          }
      }
docs: Adds package index contents. Call appropriate methods from
  the sub-classes. Adds it to the body HtmlTree
  
  @param packages array of packages to be documented
  @param text string which will be used as the heading
  @param tableSummary summary for the table
  @param body the document tree to which the index contents will be added