Java String.copyValueOf(char[] data, int offset, int count)
Syntax
String.copyValueOf(char[] data, int offset, int count) has the following syntax.
public static String copyValueOf(char[] data, int offset, int count)
Example
In the following code shows how to use String.copyValueOf(char[] data, int offset, int count) method.
public class Main {
/*w ww .j av a 2s . c om*/
public static void main(String[] arg) {
char[] textArray = { 'j', 'a', 'v', 'a', '2', 's', '.', 'c', 'o', 'm', ' ', 'j', 'a', 'v', 'a',
'2', 's', '.', 'c', 'o', 'm' };
String text = String.copyValueOf(textArray, 9, 3);
System.out.println(text);
}
}
The code above generates the following result.