Skip to content

Instantly share code, notes, and snippets.

@beta
Created October 6, 2016 06:30
Show Gist options
  • Save beta/2f015f50e59617ee166b5415ad3d18d8 to your computer and use it in GitHub Desktop.
Save beta/2f015f50e59617ee166b5415ad3d18d8 to your computer and use it in GitHub Desktop.
// Find the Java class of ArrayList
jclass arrayListClass = (*env).FindClass(“java/util/ArrayList”);
// Create an instance by finding the method ID of the constructor
jobject arrayList = (*env).NewObject(arrayListClass, (*env).GetMethodID(arrayListClass, “<init>”, “()V”));
// Find the class of float
jclass floatClass = env->FindClass(“F”);
// Let’s assume a float array contains 10 elements
jsize size = 10;
// Create arrays
jobjectArray array1 = env->NewObjectArray(size, floatClass, NULL);
jobjectArray array2 = env->NewObjectArray(size, floatClass, NULL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment