Java CharBuffer.wrap(char[] array, int offset, int length)
Syntax
CharBuffer.wrap(char[] array, int offset, int length) has the following syntax.
public static CharBuffer wrap(char[] array, int offset, int length)
Example
In the following code shows how to use CharBuffer.wrap(char[] array, int offset, int length) method.
import java.nio.CharBuffer;
/*from w w w . j a va 2s . c o m*/
public class Main {
public static void main(String[] args) {
CharBuffer cb1 = CharBuffer.wrap(new char[]{'j','a','v','a','2','s',},0,2);
System.out.println(cb1.toString());
}
}
The code above generates the following result.