title: JNI function that composes jintArray from normal c int[]
body: <p>I've been looking for a little bit now to figure out how to solve this problem, but nothing I've found quite answers this question correctly.  I think I'm close;  I'm going to want a jint* and an int*, as well as using the (*env)->SetIntArrayRegion(...) function,</p>
  
  <pre><code>//  This function will take an array of global integers that already exist in the
  //  c-side of the program, we'll call them 'data_ints[91]' (there are 91 just to clarify.)
  /*...*/
  int data_ints[] = {1,2,3,4,/*...*/90,91};
  
  JNIEXPORT jintArray JNICALL Java_MarsRoverGUI_getData
  (JNIEnv *, jobject, jint)
  {
      jintArray out_ints;
      jint *outElements;
      int i;
  
      out_ints = (*env)-&gt;NewIntArray(env, 91);
      outElements = (*env)-&gt;GetIntArrayElements(env,out_ints,0);
      for (i = 0; i &lt; 91; i++)
      {
          outElements[i] = data_ints[i];
      }
      (*env)-&gt;ReleaseIntArrayElements(env,out_ints,outElements,0);
  
      // returns data_ints as a jintArray
      return out_ints;
  }
  </code></pre>
  
  <p>Just how close am I?  I don't have an effective way of testing JNI /:  Feel free to suggest ways!</p>
  
  <p>grazie all</p>