Number of bytes in byte array
<p>I have an array <code>byte[] arr</code>;</p>

<pre><code>ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] arr = out.toByteArray();
</code></pre>

<p>How can I measure the data size in arr (if it was written to disk or transferred via network)?
Are below approaches are correct - they suppose that <code>sizeof(byte) = 1B</code></p>

<pre><code>int byteCount = out.size();
int byteMsgCount = arr.length;
</code></pre>