public static int toChars(int codePoint, char[] dst, int dstIndex) {
        if (isBmpCodePoint(codePoint)) {
            dst[dstIndex] = (char) codePoint;
            return 1;
        } else if (isValidCodePoint(codePoint)) {
            toSurrogates(codePoint, dst, dstIndex);
            return 2;
        } else {
            throw new IllegalArgumentException();
        }
    }
public static int toChars ( int codePoint , char [ ] dst , int dstIndex ) { if ( isBmpCodePoint ( codePoint ) ) { dst [ dstIndex ] = ( char ) codePoint ; return 1 ; } else if ( isValidCodePoint ( codePoint ) ) { toSurrogates ( codePoint , dst , dstIndex ) ; return 2 ; } else { throw new IllegalArgumentException ( ) ; } }
Converts the specified character (Unicode code point) to its
UTF-16 representation. If the specified code point is a BMP
(Basic Multilingual Plane or Plane 0) value, the same value is
stored in {@code dst[dstIndex]}, and 1 is returned. If the
specified code point is a supplementary character, its
surrogate values are stored in {@code dst[dstIndex]}
(high-surrogate) and {@code dst[dstIndex+1]}
(low-surrogate), and 2 is returned.

@param  codePoint the character (Unicode code point) to be converted.
@param  dst an array of {@code char} in which the
{@code codePoint}'s UTF-16 value is stored.
@param dstIndex the start index into the {@code dst}
array where the converted value is stored.
@return 1 if the code point is a BMP code point, 2 if the
code point is a supplementary code point.
@exception IllegalArgumentException if the specified
{@code codePoint} is not a valid Unicode code point.
@exception NullPointerException if the specified {@code dst} is null.
@exception IndexOutOfBoundsException if {@code dstIndex}
is negative or not less than {@code dst.length}, or if
{@code dst} at {@code dstIndex} doesn't have enough
array element(s) to store the resulting {@code char}
value(s). (If {@code dstIndex} is equal to
{@code dst.length-1} and the specified
{@code codePoint} is a supplementary character, the
high-surrogate value is not stored in
{@code dst[dstIndex]}.)
@since  1.5