Java tutorial
import java.io.CharArrayWriter; public class Main { public static void main(String[] args) { char[] ch = { 'A', 'B', 'C', 'D', 'E' }; CharArrayWriter chw = new CharArrayWriter(); // write character buffer to the writer chw.write(ch, 3, 2); String str = chw.toString(); System.out.print(str); } }