title: how to access elements from jobjectarray in jni
body: <p>I have a java method which is called from my native method and returns an object array to the native code.</p>
  
  <p>The elements of the object array are set as,</p>
  
  <pre><code>  Object[] arr = new Object[10];
      arr[0] = new Integer(12);
      arr[1] = new Float(25.5f);
  </code></pre>
  
  <p>I receive this array in my native code as follows,</p>
  
  <pre><code>  jobjectArray a = (jobjectArray)(*env)-&gt;CallStaticObjectMethodA(env, &lt;class_id&gt;, &lt;method_id&gt;, &lt;parameter_list&gt;);
  </code></pre>
  
  <p>I have the datatype of each of the element stored in object array. So based on the datatype how can I access the corresponding integer and float value in my native method.</p>
  
  <p>I tried the following,</p>
  
  <pre><code> jobject obj = (*env)-&gt;GetObjectArrayElement(env, a, 0);
      int num = (jint)obj;
  </code></pre>
  
  <p>But the value, that is set to num is incorrect. </p>