List of usage examples for java.io CharArrayReader read
public int read(char b[], int off, int len) throws IOException
From source file:Main.java
public static void main(String[] args) throws Exception { char[] ch = { 'H', 'E', 'L', 'L', 'O' }; char[] d = new char[5]; CharArrayReader car = new CharArrayReader(ch); // read character to the destination buffer car.read(d, 3, 2); // for every character in the buffer for (char c : d) { int i = (int) c; if (i == 0) { System.out.println("0"); } else {/*from w w w .j av a2 s . c om*/ System.out.println(c); } } }