Reputation: 3193
Here is my java-code which i want to convert into JNI.
How can I do this type of stuff?
Code :
public class ArrayTest
{
public static void main(String[] args)
{
int[][] a = new int[11][3];
int[] b;
for(int i = -5 ; i <=5; i++){
b = a[i + 5];
System.out.println(b.length);
}
}
}
Upvotes: 3
Views: 551
Reputation: 5361
I don't understand, which logic contains in your code, but I just show you example how to create multidirectional array:
jclass intArrayClass = env->FindClass("[I");
// create outher array
jobjectArray a = env->NewObjectArray(11, intArrayClass, NULL);
// initialize inner array
for(int i = 0; i < 11; i++)
env->SetObjectArrayElement(imgArray, i, env->NewIntArray(3));
jintArray b;
for(int i = -5 ; i <=5; i++){
b = (jintArray)env->GetObjectArrayElement(a, i + 5);
// print lenght of b array
}
Upvotes: 1