docs: public final static int convertToUTF8Bytes(int unicodeScalar, byte[] outputBytes, int offset, int maxLength)
      {
          int dst = offset;
          int end = offset + maxLength;
  
          switch (getUTF8ByteCount(unicodeScalar)) {
          case 1:
              if (dst >= end) throw new ArrayIndexOutOfBoundsException();
              outputBytes[dst++] = (byte)(unicodeScalar & 0xff);
              break;
          case 2:
              if (dst+1 >= end) throw new ArrayIndexOutOfBoundsException();
              outputBytes[dst++] = getByte1Of2(unicodeScalar);
              outputBytes[dst++] = getByte2Of2(unicodeScalar);
              break;
          case 3:
              if (dst+2 >= end) throw new ArrayIndexOutOfBoundsException();
              outputBytes[dst++] = getByte1Of3(unicodeScalar);
              outputBytes[dst++] = getByte2Of3(unicodeScalar);
              outputBytes[dst++] = getByte3Of3(unicodeScalar);
              break;
          case 4:
              if (dst+3 >= end) throw new ArrayIndexOutOfBoundsException();
              outputBytes[dst++] = getByte1Of4(unicodeScalar);
              outputBytes[dst++] = getByte2Of4(unicodeScalar);
              outputBytes[dst++] = getByte3Of4(unicodeScalar);
              outputBytes[dst++] = getByte4Of4(unicodeScalar);
              break;
          }
          return dst - offset;
      }