### Question:
ByteArrayInputStream extends InputStream { @Override public int read() { return pos < count ? buf[pos++] & 0xFF : -1; } ByteArrayInputStream(byte[] buf);  ByteArrayInputStream(ByteArrayRange byteArrayRange);  ByteArrayInputStream(byte[] buf, int offset, int length); @Override void close(); @Override int read(); @Override int read(byte[] b, int offset, int length);  }### Answer:
@Test public void testRead() { byte[] data = new byte[3]; data[0] = 1; data[1] = 2; data[2] = 3; ByteArrayInputStream bais = new ByteArrayInputStream(data); byte[] readData = new byte[3]; bais.read(readData); bais.close(); assertArrayEquals(data, readData); }