public static int unitCount(byte firstByte) {
        int units = 0;
        if (firstByte >= -16) {
            if (firstByte >= 0) {
                units = 1;
            } else {
                units = 2;
            }
        } else {
            units = 1;
        }
        return units;
    }
Calculate the number of Unicode code units ("UTF-16 characters") needed
to represent a given UTF-8 encoded code point.

@param firstByte
           the first byte of a character encoded as UTF-8
@return the number of UTF-16 code units needed to represent the given
        code point
vespajlib/src/main/java/com/yahoo/text/Utf8.java