title: Queue of byte arrays in Java
body: <p>I have a problem in my android project.
  I have queue, defined as </p>
  
  <pre><code>static private BlockingQueue&lt;byte[]&gt; rawQueue=new LinkedBlockingQueue&lt;byte[]&gt;(10000);
  </code></pre>
  
  <p>And I have code that retrieves new byte array and puts it into queue</p>
  
  <pre><code>byte[] BulkBuffer=new byte[16384];
  for(int i=0;i&lt;100;i++){
      int res=conn.bulkTransfer(endpoint, BulkBuffer, 0x4000, 0);
      if(res&gt;0){
          PacketQueue.add(BulkBuffer);
      }
  }
  </code></pre>
  
  <p>The questions are:</p>
  
  <p>1) The byte array is passed to queue by value or by reference?</p>
  
  <p>2) If it is passed by reference does it mean, that after modification of BulkBuffer the queue element will be also modified?</p>
  
  <p>3) If it is passed by reference how can I prevent modification of queue element?</p>