What is the purpose of `ByteArrayOutputStream` in Java?
`ByteArrayOutputStream` is used to write data into a byte array that can later be retrieved as an array of bytes.
Great answer! Youâ€™ve captured the purpose of `ByteArrayOutputStream` perfectly.
Can you explain how you would retrieve the written data from the `ByteArrayOutputStream`?