### Question:
SequenceInputStream extends InputStream { @Override public int read() { while (currentInputStream != null) { int result = currentInputStream.read(); if (result >= 0) return result; nextStream(); } return -1; } SequenceInputStream(InputStream s1, InputStream s2);  SequenceInputStream(ArrayList<InputStream> inputStreams); @Override void close(); @Override int read(); @Override int read(byte[] buffer, int offset, int count);  }### Answer:
@Test public void testRead() { byte[] data1 = new byte[3]; data1[0] = 1; data1[1] = 2; data1[2] = 3; ByteArrayInputStream bais1 = new ByteArrayInputStream(data1); byte[] data2 = new byte[3]; data2[0] = 4; data2[1] = 5; data2[2] = 6; ByteArrayInputStream bais2 = new ByteArrayInputStream(data2); SequenceInputStream sut = new SequenceInputStream(bais1, bais2); byte[] output = new byte[6]; sut.readFully(output); sut.read(output); sut.close(); assertEquals(data1[0], output[0]); assertEquals(data2[2], output[5]); }