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.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable