protected static AliasCandidate getHtmlEncodedEmojiAt(String input, int start) {
    if (input.length() < start + 4 || input.charAt(start) != '&' || input.charAt(start + 1) != '#') return null;

    Emoji longestEmoji = null;
    int longestCodePointEnd = -1;
    char[] chars = new char[EmojiManager.EMOJI_TRIE.maxDepth];
    int charsIndex = 0;
    int codePointStart = start;
    do {
      int codePointEnd = input.indexOf(';', codePointStart + 3);  // Code point must be at least 1 char in length
      if (codePointEnd == -1) break;

      try {
        int radix = input.charAt(codePointStart + 2) == 'x' ? 16 : 10;
        int codePoint = Integer.parseInt(input.substring(codePointStart + 2 + radix / 16, codePointEnd), radix);
        charsIndex += Character.toChars(codePoint, chars, charsIndex);
      } catch (NumberFormatException e) {
        break;
      } catch (IllegalArgumentException e) {
        break;
      }
      Emoji foundEmoji = EmojiManager.EMOJI_TRIE.getEmoji(chars, 0, charsIndex);
      if (foundEmoji != null) {
        longestEmoji = foundEmoji;
        longestCodePointEnd = codePointEnd;
      }
      codePointStart = codePointEnd + 1;
    } while (input.length() > codePointStart + 4 &&
            input.charAt(codePointStart) == '&' &&
            input.charAt(codePointStart + 1) == '#' &&
            charsIndex < chars.length &&
            !EmojiManager.EMOJI_TRIE.isEmoji(chars, 0, charsIndex).impossibleMatch());

    if (longestEmoji == null) return null;
    return new AliasCandidate(longestEmoji, null, start, longestCodePointEnd);
  }
Finds the HTML encoded emoji in the given string starting at the given point, null otherwise
src/main/java/com/vdurmont/emoji/EmojiParser.java