code: public static int insert(char target[], int limit, int offset16, int char32) {
          String str = valueOf(char32);
          if (offset16 != limit && bounds(target, 0, limit, offset16) == TRAIL_SURROGATE_BOUNDARY) {
              offset16++;
          }
          int size = str.length();
          if (limit + size > target.length) {
              throw new ArrayIndexOutOfBoundsException(offset16 + size);
          }
          System.arraycopy(target, offset16, target, offset16 + size, limit - offset16);
          target[offset16] = str.charAt(0);
          if (size == 2) {
              target[offset16 + 1] = str.charAt(1);
          }
          return limit + size;
      }
docs: Inserts char32 codepoint into target at the argument offset16. If the offset16 is in the
  middle of a supplementary codepoint, char32 will be inserted after the supplementary
  codepoint. Limit increases by one if codepoint is non-supplementary, 2 otherwise.
  <p>
  The overall effect is exactly as if the argument were converted to a string by the method
  valueOf(char) and the characters in that string were then inserted into target at the
  position indicated by offset16.
  </p>
  <p>
  The offset argument must be greater than or equal to 0, and less than or equal to the limit.
  
  @param target Char array to insert to
  @param limit End index of the char array, limit &lt;= target.length
  @param offset16 Offset which char32 will be inserted in
  @param char32 Codepoint to be inserted
  @return new limit size
  @exception IndexOutOfBoundsException Thrown if offset16 is invalid.