Java Character .offsetByCodePoints (char[] a, int start, int count, int index, int codePointOffset)
Syntax
Character.offsetByCodePoints(char[] a, int start, int count, int index, int codePointOffset) has the following syntax.
public static int offsetByCodePoints(char[] a, int start, int count, int index, int codePointOffset)
Example
In the following code shows how to use Character.offsetByCodePoints(char[] a, int start, int count, int index, int codePointOffset) method.
public class Main {
/*from w w w . jav a 2 s. c om*/
public static void main(String[] args) {
char[] c = new char[] { 'a', 'b', 'c', 'd', 'e', 'f' };
int start = 1;
int count = 5;
int res = Character.offsetByCodePoints(c, start, count, 2, 4);
String str = "The index within the subarray of c is " + res;
System.out.println( str );
}
}
The code above generates the following result.