static void adjustIndicesForSupplementaryChars(StringBuilder content,FormattedTweetText formattedTweetText){
  final List<Integer> highSurrogateIndices=new ArrayList<>();
  final int len=content.length() - 1;
  for (int i=0; i < len; ++i) {
    if (Character.isHighSurrogate(content.charAt(i)) && Character.isLowSurrogate(content.charAt(i + 1))) {
      highSurrogateIndices.add(i);
    }
  }
  adjustEntitiesWithOffsets(formattedTweetText.urlEntities,highSurrogateIndices);
  adjustEntitiesWithOffsets(formattedTweetText.mediaEntities,highSurrogateIndices);
}

static void adjustIndicesForSupplementaryChars ( StringBuilder content , FormattedTweetText formattedTweetText ) { final List < Integer > highSurrogateIndices = new ArrayList < > ( ) ; final int len = content . length ( ) - 1 ; for ( int i = 0 ; i < len ; ++ i ) { if ( Character . isHighSurrogate ( content . charAt ( i ) ) && Character . isLowSurrogate ( content . charAt ( i + 1 ) ) ) { highSurrogateIndices . add ( i ) ; } } adjustEntitiesWithOffsets ( formattedTweetText . urlEntities , highSurrogateIndices ) ; adjustEntitiesWithOffsets ( formattedTweetText . mediaEntities , highSurrogateIndices ) ; }
adjusts entity indices for supplementary characters ( emoji being the most common example ) in utf - 8 ( ones outside of u + 0000 to u + ffff range ) are represented as a pair of char values , the first from the high - surrogates range , and the second from the low - surrogates range .
