import java.io.ByteArrayInputStream;
public class TestByteArrayInputStream {
public static void main(String[] args) throws IOException {
byte[] buf = new byte[3];
buf[0] = 100;
buf[1] = 101;
buf[2] = 102;
try {
ByteArrayInputStream is = new ByteArrayInputStream(buf);
byte[] b = new byte[3];
is.read(b);
System.out.println(new String(b));
is.close();
} catch (IOException e) {
}
}
}