title: Return from java to JNI by reference
body: <p>I need to pass an array and an integer out from a java method which is called by JNI.</p>
  
  <pre><code>public static int foo(byte[] data)
  {
      byte[] buffer;
      // Fill buffer with data
      data = buffer;  // &lt;--- This doesn't work as the pointer is changed
      return bufferSize;
  }
  </code></pre>
  
  <p>At the line indicated it is my understanding that the pointer is changed but the reference I have in JNI to <code>data</code> which I passed in doesn't update so I don't get the new data.</p>
  
  <p>How would I go about returning extra data though parameters?</p>