title: Java creating byte array whose size is represented by a long
body: <p>I'm trying to create a byte array whose size is of type <code>long</code>.  For example, think of it as:</p>
  
  <pre><code>long x = _________;
  byte[] b = new byte[x]; 
  </code></pre>
  
  <p>Apparently you can only specify an <code>int</code> for the size of a byte array.</p>
  
  <p>Before anyone asks why I would need a byte array so large, I'll say I need to encapsulate data of message formats that I am not writing, and one of these message types has a length of an unsigned int (<code>long</code> in Java).</p>
  
  <p>Is there a way to create this byte array?</p>
  
  <p>I am thinking if there's no way around it, I can create a byte array output stream and keep feeding it bytes, but I don't know if there's any restriction on a size of a byte array...</p>