Online Java Compiler By
JavaTpoint.com
public class JavaCharactroffsetByCodePointsExample_1 { public static void main(String[] args) { // Create a char array ch and assign the values to char array ch. char[] ch = new char[] { 'a', 'b', 'c', 'd', 'e', 'f' }; // Create two integer primitives start and count and again assign them the values. int start = 1; int count = 5; // Again create an integer primitive result. int result; // Assign the result of offsetByCodePoints on subarray result. result = Character.offsetByCodePoints(ch, start, count, 2, 4); String str = "The index within the subarray ch is given as: " + result; // Print the result. System.err.println( str ); } }
Output