### Question:
IOUtils { public static byte[] toByteArray(final InputStream input) throws IOException { final ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); } IOUtils(); static byte[] toByteArray(final InputStream input); static InputStream toInputStream(final String str, final Charset charset); static String toString(final InputStream input, final Charset charset); static void copy(final InputStream input, final OutputStream output);  }### Answer:
@Test public void testToByteArray() throws IOException { final InputStream input = new ByteArrayInputStream("test".getBytes(StandardCharsets.UTF_8)); final byte[] output = IOUtils.toByteArray(input); assertEquals(4, output.length); }