code: public String replaceTabs(Configuration configuration, String text) {
          if (!text.contains("\t"))
              return text;
  
          final int tabLength = configuration.sourcetab;
          final String whitespace = configuration.tabSpaces;
          final int textLength = text.length();
          StringBuilder result = new StringBuilder(textLength);
          int pos = 0;
          int lineLength = 0;
          for (int i = 0; i < textLength; i++) {
              char ch = text.charAt(i);
              switch (ch) {
                  case '\n': case '\r':
                      lineLength = 0;
                      break;
                  case '\t':
                      result.append(text, pos, i);
                      int spaceCount = tabLength - lineLength % tabLength;
                      result.append(whitespace, 0, spaceCount);
                      lineLength += spaceCount;
                      pos = i + 1;
                      break;
                  default:
                      lineLength++;
              }
          }
          result.append(text, pos, textLength);
          return result.toString();
      }
docs: Replace all tabs in a string with the appropriate number of spaces.
  The string may be a multi-line string.
  @param configuration the doclet configuration defining the setting for the
  tab length.
  @param text the text for which the tabs should be expanded
  @return the text with all tabs expanded