title: Convert managed unsigned char* into a jbyte*
body: <p>How can I convert a managed unsigned char* into a jbyte*?
  since I'm new to this, a snippet would be helpful too. </p>
  
  <p>here is my native code:-</p>
  
  <pre><code>JNIEXPORT jobject JNICALL Java_com_me_NativeCaller_processImages
      (JNIEnv *env, jclass c, jbyteArray front, jbyteArray back){
  unsigned char* frontBuffer = convertJByteArrayIntoUnsignedChar(env, front);
  unsigned char* backBuffer = convertJByteArrayIntoUnsignedChar(env, back);
  System::Collections::Generic::List&lt;cli::array&lt;unsigned char&gt;^&gt;^ returnedValue = processImages(frontBuffer,backBuffer);
  jbyte* bytes;
  bytes = returnedValue[1];
  bytes = returnedValue[2];
  jbyteArray intermediateArray1 = env-&gt;NewByteArray(1);
  env-&gt;SetByteArrayRegion(intermediateArray1,0,1,bytes);
  
  return static_cast&lt;jobject&gt;(intermediateArray1);
  </code></pre>
  
  <p>}</p>
  
  <p>here at <code>bytes = returnedValue[1];</code>I'm getting an error saying "a value of type cli::array^ cannot be assign to an entity of type jbyte*"</p>
  
  <p>c# code which returns a List of byte[] :-</p>
  
  <pre><code>public static List&lt;byte[]&gt; processImages(byte[] frontImage, byte[] backImage)
      {
          CallProcessFrontBackAndMICR(frontImage,backImage);
  
          List&lt;Image&gt; imagesToReturn = GetAllPages(tiffFileBuffer);//convert byte[] into two separate images
          front = imagesToReturn[0];
          back = imagesToReturn[1];
  
          List&lt;byte[]&gt; bytesToReturn = new List&lt;byte[]&gt;();
          bytesToReturn.Add(imageToByteArray(front));
          bytesToReturn.Add(imageToByteArray(back));
  
          return bytesToReturn;
      }
  </code></pre>
  
  <p>it's really helpful if someone can help me with this.</p>