- Java.lang Package classes
- Java.lang - Home
- Java.lang - Boolean
- Java.lang - Byte
- Java.lang - Character
- Java.lang - Character.Subset
- Java.lang - Character.UnicodeBlock
- Java.lang - Class
- Java.lang - ClassLoader
- Java.lang - Compiler
- Java.lang - Double
- Java.lang - Enum
- Java.lang - Float
- Java.lang - InheritableThreadLocal
- Java.lang - Integer
- Java.lang - Long
- Java.lang - Math
- Java.lang - Number
- Java.lang - Object
- Java.lang - Package
- Java.lang - Process
- Java.lang - ProcessBuilder
- Java.lang - Runtime
- Java.lang - RuntimePermission
- Java.lang - SecurityManager
- Java.lang - Short
- Java.lang - StackTraceElement
- Java.lang - StrictMath
- Java.lang - String
- Java.lang - StringBuffer
- Java.lang - StringBuilder
- Java.lang - System
- Java.lang - Thread
- Java.lang - ThreadGroup
- Java.lang - ThreadLocal
- Java.lang - Throwable
- Java.lang - Void
- Java.lang Package extras
- Java.lang - Interfaces
- Java.lang - Errors
- Java.lang - Exceptions
- Java.lang Package Useful Resources
- Java.lang - Useful Resources
- Java.lang - Discussion
Java.lang.Character.codePointAt() Method
Description
The java.lang.Character.codePointAt(char[ ] a, int index, int limit) 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.
Declaration
Following is the declaration for java.lang.Character.codePointAt() method
public static int codePointAt(char[] a, int index, int limit)
Parameters
a − the char array
index − the index to the char values (Unicode code units) in the char array to be converted
limit − the index after the last array element that can be used in the char array
Return Value
This method returns the Unicode code point at the given index.
Exception
NullPointerException − if a is null.
IndexOutOfBoundsException − if 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.
Example
The following example shows the usage of lang.Character.codePointAt() method.
package com.tutorialspoint; import java.lang.*; public class CharacterDemo { public static void main(String[] args) { // create a char array c and assign values char[] c = new char[] { 'a', 'b', 'c', 'd', 'e' }; // create and assign value to inetgers index, limit int index = 1, limit = 3; // create an int res int res; // assign result of codePointAt on array c at index to res using limit res = Character.codePointAt(c, index, limit); String str = "Unicode code point is " + res; // print res value System.out.println( str ); } }
Let us compile and run the above program, this will produce the following result −
Unicode code point is 98