import java.io.ByteArrayInputStream;


public class ByteArrayInputStreamExample {
	public static void main(String[] args) {
		String strText="hello world";
		byte byteArray[]=strText.getBytes();
		ByteArrayInputStream bi=new ByteArrayInputStream(byteArray);;
		System.out.println("\nByteArrayInputStream holds");
		int charRead;
		while ((charRead=bi.read())!=-1)
			System.out.println(Character.toUpperCase((char) charRead));
		bi.reset();
		System.out.println();
	}
}
