code: private static int
      replaceLabel(StringBuilder dest, int destLabelStart, int destLabelLength,
                   CharSequence label, int labelLength) {
          if(label!=dest) {
              dest.delete(destLabelStart, destLabelStart+destLabelLength).insert(destLabelStart, label);
              // or dest.replace(destLabelStart, destLabelStart+destLabelLength, label.toString());
              // which would create a String rather than moving characters in the StringBuilder.
          }
          return labelLength;
      }
docs: Returns labelLength (= the new label length).