Java tutorial
import java.io.*; public class Main { public static void main(String[] args) { String s = "tutorial from java2s.com"; Reader reader = new StringReader(s); // create a char array to read chars into char cbuf[] = new char[5]; try { // read characters into a portion of an array. System.out.println(reader.read(cbuf, 0, 5)); System.out.println(cbuf); reader.close(); } catch (IOException ex) { ex.printStackTrace(); } } }