The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field whose type is char.

In addition, this class provides several methods for determining a character's category (lowercase letter, digit, etc.) and for converting characters from uppercase to lowercase and vice versa.

Character information is based on the Unicode Standard, version 4.0.

The methods and data of class Character are defined by the information in the UnicodeData file that is part of the Unicode Character Database maintained by the Unicode Consortium. This file specifies various properties including name and general category for every defined Unicode code point or character range.

The file and its description are available from the Unicode Consortium at:

Unicode Character Representations

The char data type (and therefore the value that a Character object encapsulates) are based on the original Unicode specification, which defined characters as fixed-width 16-bit entities. The Unicode standard has since been changed to allow for characters whose representation requires more than 16 bits. The range of legal code points is now U+0000 to U+10FFFF, known as Unicode scalar value. (Refer to the definition of the U+n notation in the Unicode standard.)

The set of characters from U+0000 to U+FFFF is sometimes referred to as the Basic Multilingual Plane (BMP). Characters whose code points are greater than U+FFFF are called supplementary characters. The Java 2 platform uses the UTF-16 representation in char arrays and in the String and StringBuffer classes. In this representation, supplementary characters are represented as a pair of char values, the first from the high-surrogates range, (\uD800-\uDBFF), the second from the low-surrogates range (\uDC00-\uDFFF).

A char value, therefore, represents Basic Multilingual Plane (BMP) code points, including the surrogate code points, or code units of the UTF-16 encoding. An int value represents all Unicode code points, including supplementary code points. The lower (least significant) 21 bits of int are used to represent Unicode code points and the upper (most significant) 11 bits must be zero. Unless otherwise specified, the behavior with respect to supplementary characters and surrogate char values is as follows:

In the J2SE API documentation, Unicode code point is used for character values in the range between U+0000 and U+10FFFF, and Unicode code unit is used for 16-bit char values that are code units of the UTF-16 encoding. For more information on Unicode terminology, refer to the Unicode Glossary.

@author
Lee Boynton
@author
Guy Steele
@author
Akira Tanaka
@since
1.0
Constructs a newly allocated Character object that represents the specified char value.
Parameters
valuethe value to be represented by the Character object.
General category "Mc" in the Unicode specification.
@since
1.1
General category "Pc" in the Unicode specification.
@since
1.1
General category "Cc" in the Unicode specification.
@since
1.1
General category "Sc" in the Unicode specification.
@since
1.1
General category "Pd" in the Unicode specification.
@since
1.1
General category "Nd" in the Unicode specification.
@since
1.1
Weak bidirectional character type "AN" in the Unicode specification.
@since
1.4
Weak bidirectional character type "BN" in the Unicode specification.
@since
1.4
Weak bidirectional character type "CS" in the Unicode specification.
@since
1.4
Weak bidirectional character type "EN" in the Unicode specification.
@since
1.4
Weak bidirectional character type "ES" in the Unicode specification.
@since
1.4
Weak bidirectional character type "ET" in the Unicode specification.
@since
1.4
Strong bidirectional character type "L" in the Unicode specification.
@since
1.4
Strong bidirectional character type "LRE" in the Unicode specification.
@since
1.4
Strong bidirectional character type "LRO" in the Unicode specification.
@since
1.4
Weak bidirectional character type "NSM" in the Unicode specification.
@since
1.4
Neutral bidirectional character type "ON" in the Unicode specification.
@since
1.4
Neutral bidirectional character type "B" in the Unicode specification.
@since
1.4
Weak bidirectional character type "PDF" in the Unicode specification.
@since
1.4
Strong bidirectional character type "R" in the Unicode specification.
@since
1.4
Strong bidirectional character type "AL" in the Unicode specification.
@since
1.4
Strong bidirectional character type "RLE" in the Unicode specification.
@since
1.4
Strong bidirectional character type "RLO" in the Unicode specification.
@since
1.4
Neutral bidirectional character type "S" in the Unicode specification.
@since
1.4
Undefined bidirectional character type. Undefined char values have undefined directionality in the Unicode specification.
@since
1.4
Neutral bidirectional character type "WS" in the Unicode specification.
@since
1.4
General category "Me" in the Unicode specification.
@since
1.1
General category "Pe" in the Unicode specification.
@since
1.1
General category "Pf" in the Unicode specification.
@since
1.4
General category "Cf" in the Unicode specification.
@since
1.1
General category "Pi" in the Unicode specification.
@since
1.4
General category "Nl" in the Unicode specification.
@since
1.1
General category "Zl" in the Unicode specification.
@since
1.1
General category "Ll" in the Unicode specification.
@since
1.1
General category "Sm" in the Unicode specification.
@since
1.1
The maximum value of a Unicode code point.
@since
1.5
The maximum value of a Unicode high-surrogate code unit in the UTF-16 encoding. A high-surrogate is also known as a leading-surrogate.
@since
1.5
The maximum value of a Unicode low-surrogate code unit in the UTF-16 encoding. A low-surrogate is also known as a trailing-surrogate.
@since
1.5
The maximum radix available for conversion to and from strings. The constant value of this field is the largest value permitted for the radix argument in radix-conversion methods such as the digit method, the forDigit method, and the toString method of class Integer.
The maximum value of a Unicode surrogate code unit in the UTF-16 encoding.
@since
1.5
The constant value of this field is the largest value of type char, '\uFFFF'.
@since
1.0.2
The minimum value of a Unicode code point.
@since
1.5
The minimum value of a Unicode high-surrogate code unit in the UTF-16 encoding. A high-surrogate is also known as a leading-surrogate.
@since
1.5
The minimum value of a Unicode low-surrogate code unit in the UTF-16 encoding. A low-surrogate is also known as a trailing-surrogate.
@since
1.5
The minimum radix available for conversion to and from strings. The constant value of this field is the smallest value permitted for the radix argument in radix-conversion methods such as the digit method, the forDigit method, and the toString method of class Integer.
The minimum value of a supplementary code point.
@since
1.5
The minimum value of a Unicode surrogate code unit in the UTF-16 encoding.
@since
1.5
The constant value of this field is the smallest value of type char, '\u0000'.
@since
1.0.2
General category "Lm" in the Unicode specification.
@since
1.1
General category "Sk" in the Unicode specification.
@since
1.1
General category "Mn" in the Unicode specification.
@since
1.1
General category "Lo" in the Unicode specification.
@since
1.1
General category "No" in the Unicode specification.
@since
1.1
General category "Po" in the Unicode specification.
@since
1.1
General category "So" in the Unicode specification.
@since
1.1
General category "Zp" in the Unicode specification.
@since
1.1
General category "Co" in the Unicode specification.
@since
1.1
The number of bits used to represent a char value in unsigned binary form.
@since
1.5
General category "Zs" in the Unicode specification.
@since
1.1
General category "Ps" in the Unicode specification.
@since
1.1
General category "Cs" in the Unicode specification.
@since
1.1
General category "Lt" in the Unicode specification.
@since
1.1
The Class instance representing the primitive type char.
@since
1.1
General category "Cn" in the Unicode specification.
@since
1.1
General category "Lu" in the Unicode specification.
@since
1.1
Determines the number of char values needed to represent the specified character (Unicode code point). If the specified character is equal to or greater than 0x10000, then the method returns 2. Otherwise, the method returns 1.

This method doesn't validate the specified character to be a valid Unicode code point. The caller must validate the character value using isValidCodePoint if necessary.

Parameters
codePointthe character (Unicode code point) to be tested.
Return
2 if the character is a valid supplementary character; 1 otherwise.
@since
1.5
Returns the value of this Character object.
Return
the primitive char value represented by this object.
Returns the code point at the given index of the char array. If the char value at the given index in the char array is in the high-surrogate range, the following index is less than the length of the char array, and the char value at the following index is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the char value at the given index is returned.
Parameters
athe char array
indexthe index to the char values (Unicode code units) in the char array to be converted
Return
the Unicode code point at the given index
Throws
NullPointerExceptionif a is null.
IndexOutOfBoundsExceptionif the value index is negative or not less than the length of the char array.
@since
1.5
Returns the code point at the given index of the char array, where only array elements with index less than limit can be used. If the char value at the given index in the char array is in the high-surrogate range, the following index is less than the limit, and the char value at the following index is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the char value at the given index is returned.
Parameters
athe char array
indexthe index to the char values (Unicode code units) in the char array to be converted
limitthe index after the last array element that can be used in the char array
Return
the Unicode code point at the given index
Throws
NullPointerExceptionif a is null.
IndexOutOfBoundsExceptionif the index argument is negative or not less than the limit argument, or if the limit argument is negative or greater than the length of the char array.
@since
1.5
Returns the code point at the given index of the CharSequence. If the char value at the given index in the CharSequence is in the high-surrogate range, the following index is less than the length of the CharSequence, and the char value at the following index is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the char value at the given index is returned.
Parameters
seqa sequence of char values (Unicode code units)
indexthe index to the char values (Unicode code units) in seq to be converted
Return
the Unicode code point at the given index
Throws
NullPointerExceptionif seq is null.
IndexOutOfBoundsExceptionif the value index is negative or not less than {@link CharSequence#length() seq.length()}.
@since
1.5
Returns the code point preceding the given index of the char array. If the char value at (index - 1) in the char array is in the low-surrogate range, (index - 2) is not negative, and the char value at (index - 2) in the char array is in the high-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the char value at (index - 1) is returned.
Parameters
athe char array
indexthe index following the code point that should be returned
Return
the Unicode code point value before the given index.
Throws
NullPointerExceptionif a is null.
IndexOutOfBoundsExceptionif the index argument is less than 1 or greater than the length of the char array
@since
1.5
Returns the code point preceding the given index of the char array, where only array elements with index greater than or equal to start can be used. If the char value at (index - 1) in the char array is in the low-surrogate range, (index - 2) is not less than start, and the char value at (index - 2) in the char array is in the high-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the char value at (index - 1) is returned.
Parameters
athe char array
indexthe index following the code point that should be returned
startthe index of the first array element in the char array
Return
the Unicode code point value before the given index.
Throws
NullPointerExceptionif a is null.
IndexOutOfBoundsExceptionif the index argument is not greater than the start argument or is greater than the length of the char array, or if the start argument is negative or not less than the length of the char array.
@since
1.5
Returns the code point preceding the given index of the CharSequence. If the char value at (index - 1) in the CharSequence is in the low-surrogate range, (index - 2) is not negative, and the char value at (index - 2) in the CharSequence is in the high-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the char value at (index - 1) is returned.
Parameters
seqthe CharSequence instance
indexthe index following the code point that should be returned
Return
the Unicode code point value before the given index.
Throws
NullPointerExceptionif seq is null.
IndexOutOfBoundsExceptionif the index argument is less than 1 or greater than {@link CharSequence#length() seq.length()}.
@since
1.5
Returns the number of Unicode code points in a subarray of the char array argument. The offset argument is the index of the first char of the subarray and the count argument specifies the length of the subarray in chars. Unpaired surrogates within the subarray count as one code point each.
Parameters
athe char array
offsetthe index of the first char in the given char array
countthe length of the subarray in chars
Return
the number of Unicode code points in the specified subarray
Throws
NullPointerExceptionif a is null.
IndexOutOfBoundsExceptionif offset or count is negative, or if offset + count is larger than the length of the given array.
@since
1.5
Returns the number of Unicode code points in the text range of the specified char sequence. The text range begins at the specified beginIndex and extends to the char at index endIndex - 1. Thus the length (in chars) of the text range is endIndex-beginIndex. Unpaired surrogates within the text range count as one code point each.
Parameters
seqthe char sequence
beginIndexthe index to the first char of the text range.
endIndexthe index after the last char of the text range.
Return
the number of Unicode code points in the specified text range
Throws
NullPointerExceptionif seq is null.
IndexOutOfBoundsExceptionif the beginIndex is negative, or endIndex is larger than the length of the given sequence, or beginIndex is larger than endIndex.
@since
1.5
Compares two Character objects numerically.
Parameters
anotherCharacterthe Character to be compared.
Return
the value 0 if the argument Character is equal to this Character; a value less than 0 if this Character is numerically less than the Character argument; and a value greater than 0 if this Character is numerically greater than the Character argument (unsigned comparison). Note that this is strictly a numerical comparison; it is not locale-dependent.
@since
1.2
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive. The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.

It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

Parameters
othe Object to be compared.
Return
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws
ClassCastExceptionif the specified object's type prevents it from being compared to this Object.
Returns the numeric value of the character ch in the specified radix.

If the radix is not in the range MIN_RADIX <= radix <= MAX_RADIX or if the value of ch is not a valid digit in the specified radix, -1 is returned. A character is a valid digit if at least one of the following is true:

  • The method isDigit is true of the character and the Unicode decimal digit value of the character (or its single-character decomposition) is less than the specified radix. In this case the decimal digit value is returned.
  • The character is one of the uppercase Latin letters 'A' through 'Z' and its code is less than radix + 'A' - 10. In this case, ch - 'A' + 10 is returned.
  • The character is one of the lowercase Latin letters 'a' through 'z' and its code is less than radix + 'a' - 10. In this case, ch - 'a' + 10 is returned.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be converted.
radixthe radix.
Return
the numeric value represented by the character in the specified radix.
Returns the numeric value of the specified character (Unicode code point) in the specified radix.

If the radix is not in the range MIN_RADIX <= radix <= MAX_RADIX or if the character is not a valid digit in the specified radix, -1 is returned. A character is a valid digit if at least one of the following is true:

  • The method isDigit(codePoint) is true of the character and the Unicode decimal digit value of the character (or its single-character decomposition) is less than the specified radix. In this case the decimal digit value is returned.
  • The character is one of the uppercase Latin letters 'A' through 'Z' and its code is less than radix + 'A' - 10. In this case, ch - 'A' + 10 is returned.
  • The character is one of the lowercase Latin letters 'a' through 'z' and its code is less than radix + 'a' - 10. In this case, ch - 'a' + 10 is returned.
Parameters
codePointthe character (Unicode code point) to be converted.
radixthe radix.
Return
the numeric value represented by the character in the specified radix.
@since
1.5
Compares this object against the specified object. The result is true if and only if the argument is not null and is a Character object that represents the same char value as this object.
Parameters
objthe object to compare with.
Return
true if the objects are the same; false otherwise.
Determines the character representation for a specific digit in the specified radix. If the value of radix is not a valid radix, or the value of digit is not a valid digit in the specified radix, the null character ('\u0000') is returned.

The radix argument is valid if it is greater than or equal to MIN_RADIX and less than or equal to MAX_RADIX. The digit argument is valid if 0 <=digit < radix.

If the digit is less than 10, then '0' + digit is returned. Otherwise, the value 'a' + digit - 10 is returned.

Parameters
digitthe number to convert to a character.
radixthe radix.
Return
the char representation of the specified digit in the specified radix.
Returns the runtime class of an object. That Class object is the object that is locked by static synchronized methods of the represented class.
Return
The java.lang.Class object that represents the runtime class of the object. The result is of type {@code Class} where X is the erasure of the static type of the expression on which getClass is called.
Returns the Unicode directionality property for the given character. Character directionality is used to calculate the visual ordering of text. The directionality value of undefined char values is DIRECTIONALITY_UNDEFINED.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Returns the Unicode directionality property for the given character (Unicode code point). Character directionality is used to calculate the visual ordering of text. The directionality value of undefined character is #DIRECTIONALITY_UNDEFINED .
Parameters
codePointthe character (Unicode code point) for which the directionality property * is requested.
Return
the directionality property of the character.
@since
1.5
See Also
Character#DIRECTIONALITY_UNDEFINED DIRECTIONALITY_UNDEFINED , Character#DIRECTIONALITY_LEFT_TO_RIGHT DIRECTIONALITY_LEFT_TO_RIGHT , Character#DIRECTIONALITY_RIGHT_TO_LEFT DIRECTIONALITY_RIGHT_TO_LEFT , Character#DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC , Character#DIRECTIONALITY_EUROPEAN_NUMBER DIRECTIONALITY_EUROPEAN_NUMBER , Character#DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR , Character#DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR , Character#DIRECTIONALITY_ARABIC_NUMBER DIRECTIONALITY_ARABIC_NUMBER , Character#DIRECTIONALITY_COMMON_NUMBER_SEPARATOR DIRECTIONALITY_COMMON_NUMBER_SEPARATOR , Character#DIRECTIONALITY_NONSPACING_MARK DIRECTIONALITY_NONSPACING_MARK , Character#DIRECTIONALITY_BOUNDARY_NEUTRAL DIRECTIONALITY_BOUNDARY_NEUTRAL , Character#DIRECTIONALITY_PARAGRAPH_SEPARATOR DIRECTIONALITY_PARAGRAPH_SEPARATOR , Character#DIRECTIONALITY_SEGMENT_SEPARATOR DIRECTIONALITY_SEGMENT_SEPARATOR , Character#DIRECTIONALITY_WHITESPACE DIRECTIONALITY_WHITESPACE , Character#DIRECTIONALITY_OTHER_NEUTRALS DIRECTIONALITY_OTHER_NEUTRALS , Character#DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING , Character#DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE , Character#DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING , Character#DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE , Character#DIRECTIONALITY_POP_DIRECTIONAL_FORMAT DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
Returns the int value that the specified Unicode character represents. For example, the character '\u216C' (the roman numeral fifty) will return an int with a value of 50.

The letters A-Z in their uppercase ('\u0041' through '\u005A'), lowercase ('\u0061' through '\u007A'), and full width variant ('\uFF21' through '\uFF3A' and '\uFF41' through '\uFF5A') forms have numeric values from 10 through 35. This is independent of the Unicode specification, which does not assign numeric values to these char values.

If the character does not have a numeric value, then -1 is returned. If the character has a numeric value that cannot be represented as a nonnegative integer (for example, a fractional value), then -2 is returned.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be converted.
Return
the numeric value of the character, as a nonnegative int value; -2 if the character has a numeric value that is not a nonnegative integer; -1 if the character has no numeric value.
@since
1.1
Returns the int value that the specified character (Unicode code point) represents. For example, the character '\u216C' (the Roman numeral fifty) will return an int with a value of 50.

The letters A-Z in their uppercase ('\u0041' through '\u005A'), lowercase ('\u0061' through '\u007A'), and full width variant ('\uFF21' through '\uFF3A' and '\uFF41' through '\uFF5A') forms have numeric values from 10 through 35. This is independent of the Unicode specification, which does not assign numeric values to these char values.

If the character does not have a numeric value, then -1 is returned. If the character has a numeric value that cannot be represented as a nonnegative integer (for example, a fractional value), then -2 is returned.

Parameters
codePointthe character (Unicode code point) to be converted.
Return
the numeric value of the character, as a nonnegative int value; -2 if the character has a numeric value that is not a nonnegative integer; -1 if the character has no numeric value.
@since
1.5
Returns a value indicating a character's general category.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Returns a value indicating a character's general category.
Returns a hash code for this Character.
Return
a hash code value for this object.
Determines if a character is defined in Unicode.

A character is defined if at least one of the following is true:

  • It has an entry in the UnicodeData file.
  • It has a value in a range defined by the UnicodeData file.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested
Return
true if the character has a defined meaning in Unicode; false otherwise.
@since
1.0.2
Determines if a character (Unicode code point) is defined in Unicode.

A character is defined if at least one of the following is true:

  • It has an entry in the UnicodeData file.
  • It has a value in a range defined by the UnicodeData file.
Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character has a defined meaning in Unicode; false otherwise.
@since
1.5
Determines if the specified character is a digit.

A character is a digit if its general category type, provided by Character.getType(ch), is DECIMAL_DIGIT_NUMBER.

Some Unicode character ranges that contain digits:

  • '\u0030' through '\u0039', ISO-LATIN-1 digits ('0' through '9')
  • '\u0660' through '\u0669', Arabic-Indic digits
  • '\u06F0' through '\u06F9', Extended Arabic-Indic digits
  • '\u0966' through '\u096F', Devanagari digits
  • '\uFF10' through '\uFF19', Fullwidth digits
Many other character ranges contain digits as well.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character is a digit; false otherwise.
Determines if the specified character (Unicode code point) is a digit.

A character is a digit if its general category type, provided by getType(codePoint) , is DECIMAL_DIGIT_NUMBER.

Some Unicode character ranges that contain digits:

  • '\u0030' through '\u0039', ISO-LATIN-1 digits ('0' through '9')
  • '\u0660' through '\u0669', Arabic-Indic digits
  • '\u06F0' through '\u06F9', Extended Arabic-Indic digits
  • '\u0966' through '\u096F', Devanagari digits
  • '\uFF10' through '\uFF19', Fullwidth digits
Many other character ranges contain digits as well.
Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is a digit; false otherwise.
@since
1.5
Determines if the given char value is a high-surrogate code unit (also known as leading-surrogate code unit). Such values do not represent characters by themselves, but are used in the representation of supplementary characters in the UTF-16 encoding.

This method returns true if and only if

ch >= '\uD800' && ch <= '\uDBFF'
 
is true.
Parameters
chthe char value to be tested.
Return
true if the char value is between '\uD800' and '\uDBFF' inclusive; false otherwise.
@since
1.5
Determines if the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

The following Unicode characters are ignorable in a Java identifier or a Unicode identifier:

  • ISO control characters that are not whitespace
    • '\u0000' through '\u0008'
    • '\u000E' through '\u001B'
    • '\u007F' through '\u009F'
  • all characters that have the FORMAT general category value

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character is an ignorable control character that may be part of a Java or Unicode identifier; false otherwise.
@since
1.1
Determines if the specified character (Unicode code point) should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

The following Unicode characters are ignorable in a Java identifier or a Unicode identifier:

  • ISO control characters that are not whitespace
    • '\u0000' through '\u0008'
    • '\u000E' through '\u001B'
    • '\u007F' through '\u009F'
  • all characters that have the FORMAT general category value
Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is an ignorable control character that may be part of a Java or Unicode identifier; false otherwise.
@since
1.5
Determines if the specified character is an ISO control character. A character is considered to be an ISO control character if its code is in the range '\u0000' through '\u001F' or in the range '\u007F' through '\u009F'.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character is an ISO control character; false otherwise.
@since
1.1
Determines if the referenced character (Unicode code point) is an ISO control character. A character is considered to be an ISO control character if its code is in the range '\u0000' through '\u001F' or in the range '\u007F' through '\u009F'.
Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is an ISO control character; false otherwise.
@since
1.5
Determines if the specified character may be part of a Java identifier as other than the first character.

A character may be part of a Java identifier if any of the following are true:

  • it is a letter
  • it is a currency symbol (such as '$')
  • it is a connecting punctuation character (such as '_')
  • it is a digit
  • it is a numeric letter (such as a Roman numeral character)
  • it is a combining mark
  • it is a non-spacing mark
  • isIdentifierIgnorable returns true for the character

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character may be part of a Java identifier; false otherwise.
@since
1.1
Determines if the character (Unicode code point) may be part of a Java identifier as other than the first character.

A character may be part of a Java identifier if any of the following are true:

  • it is a letter
  • it is a currency symbol (such as '$')
  • it is a connecting punctuation character (such as '_')
  • it is a digit
  • it is a numeric letter (such as a Roman numeral character)
  • it is a combining mark
  • it is a non-spacing mark
  • isIdentifierIgnorable(codePoint) returns true for the character
Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character may be part of a Java identifier; false otherwise.
@since
1.5
Determines if the specified character is permissible as the first character in a Java identifier.

A character may start a Java identifier if and only if one of the following conditions is true:

  • isLetter(ch) returns true
  • getType(ch) returns LETTER_NUMBER
  • ch is a currency symbol (such as "$")
  • ch is a connecting punctuation character (such as "_").

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character may start a Java identifier; false otherwise.
@since
1.1
Determines if the character (Unicode code point) is permissible as the first character in a Java identifier.

A character may start a Java identifier if and only if one of the following conditions is true:

  • isLetter(codePoint) returns true
  • getType(codePoint) returns LETTER_NUMBER
  • the referenced character is a currency symbol (such as "$")
  • the referenced character is a connecting punctuation character (such as "_").
Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character may start a Java identifier; false otherwise.
@since
1.5
Determines if the specified character is permissible as the first character in a Java identifier.

A character may start a Java identifier if and only if one of the following is true:

  • isLetter(ch) returns true
  • getType(ch) returns LETTER_NUMBER
  • ch is a currency symbol (such as "$")
  • ch is a connecting punctuation character (such as "_").
Parameters
chthe character to be tested.
Return
true if the character may start a Java identifier; false otherwise.
@since
1.02
@deprecated
Replaced by isJavaIdentifierStart(char).
Determines if the specified character may be part of a Java identifier as other than the first character.

A character may be part of a Java identifier if and only if any of the following are true:

  • it is a letter
  • it is a currency symbol (such as '$')
  • it is a connecting punctuation character (such as '_')
  • it is a digit
  • it is a numeric letter (such as a Roman numeral character)
  • it is a combining mark
  • it is a non-spacing mark
  • isIdentifierIgnorable returns true for the character.
Parameters
chthe character to be tested.
Return
true if the character may be part of a Java identifier; false otherwise.
@since
1.02
@deprecated
Replaced by isJavaIdentifierPart(char).
Determines if the specified character is a letter.

A character is considered to be a letter if its general category type, provided by Character.getType(ch), is any of the following:

  • UPPERCASE_LETTER
  • LOWERCASE_LETTER
  • TITLECASE_LETTER
  • MODIFIER_LETTER
  • OTHER_LETTER
Not all letters have case. Many characters are letters but are neither uppercase nor lowercase nor titlecase.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Determines if the specified character (Unicode code point) is a letter.

A character is considered to be a letter if its general category type, provided by getType(codePoint) , is any of the following:

  • UPPERCASE_LETTER
  • LOWERCASE_LETTER
  • TITLECASE_LETTER
  • MODIFIER_LETTER
  • OTHER_LETTER
Not all letters have case. Many characters are letters but are neither uppercase nor lowercase nor titlecase.
Determines if the specified character is a letter or digit.

A character is considered to be a letter or digit if either Character.isLetter(char ch) or Character.isDigit(char ch) returns true for the character.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Determines if the specified character (Unicode code point) is a letter or digit.

A character is considered to be a letter or digit if either isLetter(codePoint) or isDigit(codePoint) returns true for the character.

Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is a letter or digit; false otherwise.
@since
1.5
Determines if the specified character is a lowercase character.

A character is lowercase if its general category type, provided by Character.getType(ch), is LOWERCASE_LETTER.

The following are examples of lowercase characters:

 a b c d e f g h i j k l m n o p q r s t u v w x y z
 '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6' 
 '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
 '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
 '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
 

Many other Unicode characters are lowercase too.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character is lowercase; false otherwise.
Determines if the specified character (Unicode code point) is a lowercase character.

A character is lowercase if its general category type, provided by , is LOWERCASE_LETTER.

The following are examples of lowercase characters:

 a b c d e f g h i j k l m n o p q r s t u v w x y z
 '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6' 
 '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
 '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
 '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
 

Many other Unicode characters are lowercase too.

Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is lowercase; false otherwise.
@since
1.5
Determines if the given char value is a low-surrogate code unit (also known as trailing-surrogate code unit). Such values do not represent characters by themselves, but are used in the representation of supplementary characters in the UTF-16 encoding.

This method returns true if and only if

ch >= '\uDC00' && ch <= '\uDFFF'
 
is true.
Parameters
chthe char value to be tested.
Return
true if the char value is between '\uDC00' and '\uDFFF' inclusive; false otherwise.
@since
1.5
Determines whether the character is mirrored according to the Unicode specification. Mirrored characters should have their glyphs horizontally mirrored when displayed in text that is right-to-left. For example, '\u0028' LEFT PARENTHESIS is semantically defined to be an opening parenthesis. This will appear as a "(" in text that is left-to-right but as a ")" in text that is right-to-left.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chchar for which the mirrored property is requested
Return
true if the char is mirrored, false if the char is not mirrored or is not defined.
@since
1.4
Determines whether the specified character (Unicode code point) is mirrored according to the Unicode specification. Mirrored characters should have their glyphs horizontally mirrored when displayed in text that is right-to-left. For example, '\u0028' LEFT PARENTHESIS is semantically defined to be an opening parenthesis. This will appear as a "(" in text that is left-to-right but as a ")" in text that is right-to-left.
Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is mirrored, false if the character is not mirrored or is not defined.
@since
1.5
Determines if the specified character is ISO-LATIN-1 white space. This method returns true for the following five characters only:
'\t' '\u0009' HORIZONTAL TABULATION
'\n' '\u000A' NEW LINE
'\f' '\u000C' FORM FEED
'\r' '\u000D' CARRIAGE RETURN
' ' '\u0020' SPACE
Parameters
chthe character to be tested.
Return
true if the character is ISO-LATIN-1 white space; false otherwise.
@deprecated
Replaced by isWhitespace(char).
Determines if the specified character is a Unicode space character. A character is considered to be a space character if and only if it is specified to be a space character by the Unicode standard. This method returns true if the character's general category type is any of the following:
  • SPACE_SEPARATOR
  • LINE_SEPARATOR
  • PARAGRAPH_SEPARATOR

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character is a space character; false otherwise.
@since
1.1
Determines if the specified character (Unicode code point) is a Unicode space character. A character is considered to be a space character if and only if it is specified to be a space character by the Unicode standard. This method returns true if the character's general category type is any of the following:
Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is a space character; false otherwise.
@since
1.5
Determines whether the specified character (Unicode code point) is in the supplementary character range. The method call is equivalent to the expression:
 codePoint >= 0x10000 && codePoint <= 0x10ffff
 
Parameters
codePointthe character (Unicode code point) to be tested
Return
true if the specified character is in the Unicode supplementary character range; false otherwise.
@since
1.5
Determines whether the specified pair of char values is a valid surrogate pair. This method is equivalent to the expression:
 isHighSurrogate(high) && isLowSurrogate(low)
 
Parameters
highthe high-surrogate code value to be tested
lowthe low-surrogate code value to be tested
Return
true if the specified high and low-surrogate code values represent a valid surrogate pair; false otherwise.
@since
1.5
Determines if the specified character is a titlecase character.

A character is a titlecase character if its general category type, provided by Character.getType(ch), is TITLECASE_LETTER.

Some characters look like pairs of Latin letters. For example, there is an uppercase letter that looks like "LJ" and has a corresponding lowercase letter that looks like "lj". A third form, which looks like "Lj", is the appropriate form to use when rendering a word in lowercase with initial capitals, as for a book title.

These are some of the Unicode characters for which this method returns true:

  • LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
  • LATIN CAPITAL LETTER L WITH SMALL LETTER J
  • LATIN CAPITAL LETTER N WITH SMALL LETTER J
  • LATIN CAPITAL LETTER D WITH SMALL LETTER Z

Many other Unicode characters are titlecase too.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character is titlecase; false otherwise.
@since
1.0.2
Determines if the specified character (Unicode code point) is a titlecase character.

A character is a titlecase character if its general category type, provided by getType(codePoint) , is TITLECASE_LETTER.

Some characters look like pairs of Latin letters. For example, there is an uppercase letter that looks like "LJ" and has a corresponding lowercase letter that looks like "lj". A third form, which looks like "Lj", is the appropriate form to use when rendering a word in lowercase with initial capitals, as for a book title.

These are some of the Unicode characters for which this method returns true:

  • LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
  • LATIN CAPITAL LETTER L WITH SMALL LETTER J
  • LATIN CAPITAL LETTER N WITH SMALL LETTER J
  • LATIN CAPITAL LETTER D WITH SMALL LETTER Z

Many other Unicode characters are titlecase too.

Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is titlecase; false otherwise.
@since
1.5
Determines if the specified character may be part of a Unicode identifier as other than the first character.

A character may be part of a Unicode identifier if and only if one of the following statements is true:

  • it is a letter
  • it is a connecting punctuation character (such as '_')
  • it is a digit
  • it is a numeric letter (such as a Roman numeral character)
  • it is a combining mark
  • it is a non-spacing mark
  • isIdentifierIgnorable returns true for this character.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character may be part of a Unicode identifier; false otherwise.
@since
1.1
Determines if the specified character (Unicode code point) may be part of a Unicode identifier as other than the first character.

A character may be part of a Unicode identifier if and only if one of the following statements is true:

  • it is a letter
  • it is a connecting punctuation character (such as '_')
  • it is a digit
  • it is a numeric letter (such as a Roman numeral character)
  • it is a combining mark
  • it is a non-spacing mark
  • isIdentifierIgnorable returns true for this character.
Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character may be part of a Unicode identifier; false otherwise.
@since
1.5
Determines if the specified character is permissible as the first character in a Unicode identifier.

A character may start a Unicode identifier if and only if one of the following conditions is true:

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character may start a Unicode identifier; false otherwise.
@since
1.1
Determines if the specified character (Unicode code point) is permissible as the first character in a Unicode identifier.

A character may start a Unicode identifier if and only if one of the following conditions is true:

Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character may start a Unicode identifier; false otherwise.
@since
1.5
Determines if the specified character is an uppercase character.

A character is uppercase if its general category type, provided by Character.getType(ch), is UPPERCASE_LETTER.

The following are examples of uppercase characters:

 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
 '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
 '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
 '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
 

Many other Unicode characters are uppercase too.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character is uppercase; false otherwise.
@since
1.0
Determines if the specified character (Unicode code point) is an uppercase character.

A character is uppercase if its general category type, provided by getType(codePoint) , is UPPERCASE_LETTER.

The following are examples of uppercase characters:

 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
 '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
 '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
 '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
 

Many other Unicode characters are uppercase too.

Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is uppercase; false otherwise.
@since
1.5
Determines whether the specified code point is a valid Unicode code point value in the range of 0x0000 to 0x10FFFF inclusive. This method is equivalent to the expression:
 codePoint >= 0x0000 && codePoint <= 0x10FFFF
 
Parameters
codePointthe Unicode code point to be tested
Return
true if the specified code point value is a valid code point value; false otherwise.
@since
1.5
Determines if the specified character is white space according to Java. A character is a Java whitespace character if and only if it satisfies one of the following criteria:
  • It is a Unicode space character (SPACE_SEPARATOR, LINE_SEPARATOR, or PARAGRAPH_SEPARATOR) but is not also a non-breaking space ('\u00A0', '\u2007', '\u202F').
  • It is '\u0009', HORIZONTAL TABULATION.
  • It is '\u000A', LINE FEED.
  • It is '\u000B', VERTICAL TABULATION.
  • It is '\u000C', FORM FEED.
  • It is '\u000D', CARRIAGE RETURN.
  • It is '\u001C', FILE SEPARATOR.
  • It is '\u001D', GROUP SEPARATOR.
  • It is '\u001E', RECORD SEPARATOR.
  • It is '\u001F', UNIT SEPARATOR.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be tested.
Return
true if the character is a Java whitespace character; false otherwise.
@since
1.1
Determines if the specified character (Unicode code point) is white space according to Java. A character is a Java whitespace character if and only if it satisfies one of the following criteria:
  • It is a Unicode space character (#SPACE_SEPARATOR , #LINE_SEPARATOR , or #PARAGRAPH_SEPARATOR ) but is not also a non-breaking space ('\u00A0', '\u2007', '\u202F').
  • It is '\u0009', HORIZONTAL TABULATION.
  • It is '\u000A', LINE FEED.
  • It is '\u000B', VERTICAL TABULATION.
  • It is '\u000C', FORM FEED.
  • It is '\u000D', CARRIAGE RETURN.
  • It is '\u001C', FILE SEPARATOR.
  • It is '\u001D', GROUP SEPARATOR.
  • It is '\u001E', RECORD SEPARATOR.
  • It is '\u001F', UNIT SEPARATOR.

Parameters
codePointthe character (Unicode code point) to be tested.
Return
true if the character is a Java whitespace character; false otherwise.
@since
1.5
Wakes up a single thread that is waiting on this object's monitor. If any threads are waiting on this object, one of them is chosen to be awakened. The choice is arbitrary and occurs at the discretion of the implementation. A thread waits on an object's monitor by calling one of the wait methods.

The awakened thread will not be able to proceed until the current thread relinquishes the lock on this object. The awakened thread will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened thread enjoys no reliable privilege or disadvantage in being the next thread to lock this object.

This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways:

  • By executing a synchronized instance method of that object.
  • By executing the body of a synchronized statement that synchronizes on the object.
  • For objects of type Class, by executing a synchronized static method of that class.

Only one thread at a time can own an object's monitor.

Throws
IllegalMonitorStateExceptionif the current thread is not the owner of this object's monitor.
Wakes up all threads that are waiting on this object's monitor. A thread waits on an object's monitor by calling one of the wait methods.

The awakened threads will not be able to proceed until the current thread relinquishes the lock on this object. The awakened threads will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened threads enjoy no reliable privilege or disadvantage in being the next thread to lock this object.

This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.

Throws
IllegalMonitorStateExceptionif the current thread is not the owner of this object's monitor.
Returns the index within the given char subarray that is offset from the given index by codePointOffset code points. The start and count arguments specify a subarray of the char array. Unpaired surrogates within the text range given by index and codePointOffset count as one code point each.
Parameters
athe char array
startthe index of the first char of the subarray
countthe length of the subarray in chars
indexthe index to be offset
codePointOffsetthe offset in code points
Return
the index within the subarray
Throws
NullPointerExceptionif a is null.
IndexOutOfBoundsExceptionif start or count is negative, or if start + count is larger than the length of the given array, or if index is less than start or larger then start + count, or if codePointOffset is positive and the text range starting with index and ending with start + count - 1 has fewer than codePointOffset code points, or if codePointOffset is negative and the text range starting with start and ending with index - 1 has fewer than the absolute value of codePointOffset code points.
@since
1.5
Returns the index within the given char sequence that is offset from the given index by codePointOffset code points. Unpaired surrogates within the text range given by index and codePointOffset count as one code point each.
Parameters
seqthe char sequence
indexthe index to be offset
codePointOffsetthe offset in code points
Return
the index within the char sequence
Throws
NullPointerExceptionif seq is null.
IndexOutOfBoundsExceptionif index is negative or larger then the length of the char sequence, or if codePointOffset is positive and the subsequence starting with index has fewer than codePointOffset code points, or if codePointOffset is negative and the subsequence before index has fewer than the absolute value of codePointOffset code points.
@since
1.5
Returns the value obtained by reversing the order of the bytes in the specified char value.
Return
the value obtained by reversing (or, equivalently, swapping) the bytes in the specified char value.
@since
1.5
Converts the specified character (Unicode code point) to its UTF-16 representation stored in a char array. If the specified code point is a BMP (Basic Multilingual Plane or Plane 0) value, the resulting char array has the same value as codePoint. If the specified code point is a supplementary code point, the resulting char array has the corresponding surrogate pair.
Parameters
codePointa Unicode code point
Return
a char array having codePoint's UTF-16 representation.
Throws
IllegalArgumentExceptionif the specified codePoint is not a valid Unicode code point.
@since
1.5
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 dst[dstIndex], and 1 is returned. If the specified code point is a supplementary character, its surrogate values are stored in dst[dstIndex] (high-surrogate) and dst[dstIndex+1] (low-surrogate), and 2 is returned.
Parameters
codePointthe character (Unicode code point) to be converted.
dstan array of char in which the codePoint's UTF-16 value is stored.
dstIndexthe start index into the 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.
Throws
IllegalArgumentExceptionif the specified codePoint is not a valid Unicode code point.
NullPointerExceptionif the specified dst is null.
IndexOutOfBoundsExceptionif dstIndex is negative or not less than dst.length, or if dst at dstIndex doesn't have enough array element(s) to store the resulting char value(s). (If dstIndex is equal to dst.length-1 and the specified codePoint is a supplementary character, the high-surrogate value is not stored in dst[dstIndex].)
@since
1.5
Converts the specified surrogate pair to its supplementary code point value. This method does not validate the specified surrogate pair. The caller must validate it using isSurrogatePair if necessary.
Parameters
highthe high-surrogate code unit
lowthe low-surrogate code unit
Return
the supplementary code point composed from the specified surrogate pair.
@since
1.5
Converts the character argument to lowercase using case mapping information from the UnicodeData file.

Note that Character.isLowerCase(Character.toLowerCase(ch)) does not always return true for some ranges of characters, particularly those that are symbols or ideographs.

In general, should be used to map characters to lowercase. String case mapping methods have several benefits over Character case mapping methods. String case mapping methods can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whereas the Character case mapping methods cannot.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be converted.
Return
the lowercase equivalent of the character, if any; otherwise, the character itself.
Converts the character (Unicode code point) argument to lowercase using case mapping information from the UnicodeData file.

Note that Character.isLowerCase(Character.toLowerCase(codePoint)) does not always return true for some ranges of characters, particularly those that are symbols or ideographs.

In general, should be used to map characters to lowercase. String case mapping methods have several benefits over Character case mapping methods. String case mapping methods can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whereas the Character case mapping methods cannot.

Parameters
codePointthe character (Unicode code point) to be converted.
Return
the lowercase equivalent of the character (Unicode code point), if any; otherwise, the character itself.
@since
1.5
Returns a String object representing this Character's value. The result is a string of length 1 whose sole component is the primitive char value represented by this Character object.
Return
a string representation of this object.
Returns a String object representing the specified char. The result is a string of length 1 consisting solely of the specified char.
Parameters
cthe char to be converted
Return
the string representation of the specified char
@since
1.4
Converts the character argument to titlecase using case mapping information from the UnicodeData file. If a character has no explicit titlecase mapping and is not itself a titlecase char according to UnicodeData, then the uppercase mapping is returned as an equivalent titlecase mapping. If the char argument is already a titlecase char, the same char value will be returned.

Note that Character.isTitleCase(Character.toTitleCase(ch)) does not always return true for some ranges of characters.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be converted.
Return
the titlecase equivalent of the character, if any; otherwise, the character itself.
@since
1.0.2
Converts the character (Unicode code point) argument to titlecase using case mapping information from the UnicodeData file. If a character has no explicit titlecase mapping and is not itself a titlecase char according to UnicodeData, then the uppercase mapping is returned as an equivalent titlecase mapping. If the character argument is already a titlecase character, the same character value will be returned.

Note that Character.isTitleCase(Character.toTitleCase(codePoint)) does not always return true for some ranges of characters.

Parameters
codePointthe character (Unicode code point) to be converted.
Return
the titlecase equivalent of the character, if any; otherwise, the character itself.
@since
1.5
Converts the character argument to uppercase using case mapping information from the UnicodeData file.

Note that Character.isUpperCase(Character.toUpperCase(ch)) does not always return true for some ranges of characters, particularly those that are symbols or ideographs.

In general, should be used to map characters to uppercase. String case mapping methods have several benefits over Character case mapping methods. String case mapping methods can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whereas the Character case mapping methods cannot.

Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the method.

Parameters
chthe character to be converted.
Return
the uppercase equivalent of the character, if any; otherwise, the character itself.
Converts the character (Unicode code point) argument to uppercase using case mapping information from the UnicodeData file.

Note that Character.isUpperCase(Character.toUpperCase(codePoint)) does not always return true for some ranges of characters, particularly those that are symbols or ideographs.

In general, should be used to map characters to uppercase. String case mapping methods have several benefits over Character case mapping methods. String case mapping methods can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whereas the Character case mapping methods cannot.

Parameters
codePointthe character (Unicode code point) to be converted.
Return
the uppercase equivalent of the character, if any; otherwise, the character itself.
@since
1.5
Returns a Character instance representing the specified char value. If a new Character instance is not required, this method should generally be used in preference to the constructor , as this method is likely to yield significantly better space and time performance by caching frequently requested values.
Parameters
ca char value.
Return
a Character instance representing c.
@since
1.5
Causes current thread to wait until another thread invokes the method or the method for this object. In other words, this method behaves exactly as if it simply performs the call wait(0).

The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method. The thread then waits until it can re-obtain ownership of the monitor and resumes execution.

As in the one argument version, interrupts and spurious wakeups are possible, and this method should always be used in a loop:

     synchronized (obj) {
         while (<condition does not hold>)
             obj.wait();
         ... // Perform action appropriate to condition
     }
 
This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.
Throws
IllegalMonitorStateExceptionif the current thread is not the owner of the object's monitor.
InterruptedExceptionif another thread interrupted the current thread before or while the current thread was waiting for a notification. The interrupted status of the current thread is cleared when this exception is thrown.
Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.

The current thread must own this object's monitor.

This method causes the current thread (call it T) to place itself in the wait set for this object and then to relinquish any and all synchronization claims on this object. Thread T becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:

  • Some other thread invokes the notify method for this object and thread T happens to be arbitrarily chosen as the thread to be awakened.
  • Some other thread invokes the notifyAll method for this object.
  • Some other thread interrupts thread T.
  • The specified amount of real time has elapsed, more or less. If timeout is zero, however, then real time is not taken into consideration and the thread simply waits until notified.
The thread T is then removed from the wait set for this object and re-enabled for thread scheduling. It then competes in the usual manner with other threads for the right to synchronize on the object; once it has gained control of the object, all its synchronization claims on the object are restored to the status quo ante - that is, to the situation as of the time that the wait method was invoked. Thread T then returns from the invocation of the wait method. Thus, on return from the wait method, the synchronization state of the object and of thread T is exactly as it was when the wait method was invoked.

A thread can also wake up without being notified, interrupted, or timing out, a so-called spurious wakeup. While this will rarely occur in practice, applications must guard against it by testing for the condition that should have caused the thread to be awakened, and continuing to wait if the condition is not satisfied. In other words, waits should always occur in loops, like this one:

     synchronized (obj) {
         while (<condition does not hold>)
             obj.wait(timeout);
         ... // Perform action appropriate to condition
     }
 
(For more information on this topic, see Section 3.2.3 in Doug Lea's "Concurrent Programming in Java (Second Edition)" (Addison-Wesley, 2000), or Item 50 in Joshua Bloch's "Effective Java Programming Language Guide" (Addison-Wesley, 2001).

If the current thread is interrupted by another thread while it is waiting, then an InterruptedException is thrown. This exception is not thrown until the lock status of this object has been restored as described above.

Note that the wait method, as it places the current thread into the wait set for this object, unlocks only this object; any other objects on which the current thread may be synchronized remain locked while the thread waits.

This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.

Parameters
timeoutthe maximum time to wait in milliseconds.
Throws
IllegalArgumentExceptionif the value of timeout is negative.
IllegalMonitorStateExceptionif the current thread is not the owner of the object's monitor.
InterruptedExceptionif another thread interrupted the current thread before or while the current thread was waiting for a notification. The interrupted status of the current thread is cleared when this exception is thrown.
Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

This method is similar to the wait method of one argument, but it allows finer control over the amount of time to wait for a notification before giving up. The amount of real time, measured in nanoseconds, is given by:

 1000000*timeout+nanos

In all other respects, this method does the same thing as the method of one argument. In particular, wait(0, 0) means the same thing as wait(0).

The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until either of the following two conditions has occurred:

  • Another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method.
  • The timeout period, specified by timeout milliseconds plus nanos nanoseconds arguments, has elapsed.

The thread then waits until it can re-obtain ownership of the monitor and resumes execution.

As in the one argument version, interrupts and spurious wakeups are possible, and this method should always be used in a loop:

     synchronized (obj) {
         while (<condition does not hold>)
             obj.wait(timeout, nanos);
         ... // Perform action appropriate to condition
     }
 
This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.
Parameters
timeoutthe maximum time to wait in milliseconds.
nanosadditional time, in nanoseconds range 0-999999.
Throws
IllegalArgumentExceptionif the value of timeout is negative or the value of nanos is not in the range 0-999999.
IllegalMonitorStateExceptionif the current thread is not the owner of this object's monitor.
InterruptedExceptionif another thread interrupted the current thread before or while the current thread was waiting for a notification. The interrupted status of the current thread is cleared when this exception is thrown.