public static int countEmojis(String text){
  String htmlifiedText=htmlify(text);
  Matcher matcher=htmlEntityPattern.matcher(htmlifiedText);
  int counter=0;
  while (matcher.find()) {
    String emojiCode=matcher.group();
    if (isEmoji(emojiCode)) {
      counter++;
    }
  }
  return counter;
}

public static int countEmojis ( String text ) { String htmlifiedText = htmlify ( text ) ; Matcher matcher = htmlEntityPattern . matcher ( htmlifiedText ) ; int counter = 0 ; while ( matcher . find ( ) ) { String emojiCode = matcher . group ( ) ; if ( isEmoji ( emojiCode ) ) { counter ++ ; } } return counter ; }
counts valid emojis passed string
