private static void parseEntities(final HtmlBuilder builder, final EntitySupport entities) {
   // Format media.
   final MediaEntity[] mediaEntities = entities.getMediaEntities();
   if (mediaEntities != null) {
     for (final MediaEntity mediaEntity : mediaEntities) {
       final int start = mediaEntity.getStart(), end = mediaEntity.getEnd();
       final String mediaUrl = TwitterContentUtils.getMediaUrl(mediaEntity);
       if (mediaUrl != null && start >= 0 && end >= 0) {
         builder.addLink(mediaUrl, mediaEntity.getDisplayUrl(), start, end);
       }
     }
   }
   final UrlEntity[] urlEntities = entities.getUrlEntities();
   if (urlEntities != null) {
     for (final UrlEntity urlEntity : urlEntities) {
       final int start = urlEntity.getStart(), end = urlEntity.getEnd();
       final String expandedUrl = urlEntity.getExpandedUrl();
       if (expandedUrl != null && start >= 0 && end >= 0) {
         builder.addLink(expandedUrl, urlEntity.getDisplayUrl(), start, end);
       }
     }
   }
 }
 public static String formatUserDescription(final User user) {
   if (user == null) return null;
   final String text = user.getDescription();
   if (text == null) return null;
   final HtmlBuilder builder = new HtmlBuilder(text, false, true, true);
   final UrlEntity[] urls = user.getDescriptionEntities();
   if (urls != null) {
     for (final UrlEntity url : urls) {
       final String expanded_url = url.getExpandedUrl();
       if (expanded_url != null) {
         builder.addLink(expanded_url, url.getDisplayUrl(), url.getStart(), url.getEnd());
       }
     }
   }
   return builder.build();
 }