public static intoffsetByCodePoints(CharSequence seq, int
index, int numberOfCodePoints)
Returns the index into the CharSequence, that is
numberOfCodePoints away from index, taking into account surrogate
pairs.
public static char[]toChars(int codePoint)
Converts a code point to its UTF-16 representation as a one- or two-char
array. If codePoint is not valid, IllegalArgumentException is
thrown.
public static inttoChars(int codePoint, char[] dst, int
dstBegin)
Converts a code point to its UTF-16 representation, storing it in dst starting
at dst[dstBegin] and returning the number of characters written (either
1 or 2). If codePoint is not valid, IllegalArgumentException is
thrown.
public static inttoCodePoint(char high, char low)
Converts the given surrogate pair of char values to their supplementary
code point value. This method does not check that high and low form a
valid surrogate pair, so you must check that yourself by using
isSurrogatePair.
All of these methods that use indices can throw IndexOutOfBoundsException, if you cause them to try
to index outside the given array, or CharSequence, accounting for any imposed limits on the valid range of
indices.
8.6. Boxing Conversions
The automatic conversion of a variable of primitive type into an instance of its wrapper class, is termed a
boxing conversionthe wrapper object acts like a "box" in which the primitive value is held. The opposite
conversion, from an instance of a wrapper class to a primitive value, is termed an unboxing conversion.
A boxing conversion replaces any primitive value v with a wrapper object of the same value. The wrapper
object's type corresponds to the type of v. For example, given
Integer val = 3;
val will refer to an Integer object because 3 is an int value; val.intValue() will return the value 3.
An unboxing conversion takes a reference to a wrapper object and extracts its primitive value. Building on the
previous example,
int x = val;