Java tutorial
import java.io.ByteArrayInputStream; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { byte[] buf = { 65, 66, 67, 68, 69, 70, 71, 72, 73 }; // create new byte array input stream ByteArrayInputStream bais = new ByteArrayInputStream(buf, 2, 3); } }