Java StringBuffer.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Syntax
StringBuffer.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) has the following syntax.
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Example
In the following code shows how to use StringBuffer.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) method.
/*www . j a v a 2 s. c om*/
public class Main {
public static void main(String args[]) {
StringBuffer buffer = new StringBuffer("hello there from java2s.com");
char charArray[] = new char[buffer.length()];
buffer.getChars(0, buffer.length(), charArray, 0);
System.out.print("The characters are: ");
}
}
The code above generates the following result.