IntPtr intArray = JNIEnv.NewIntArray(10); int length = JNIEnv.GetArrayLength(intArray); Console.WriteLine("Length of intArray is: " + length);
IntPtr stringArray = JNIEnv.NewObjectArray(10, JNIEnv.FindClass("java/lang/String"), IntPtr.Zero); int length = JNIEnv.GetArrayLength(stringArray); Console.WriteLine("Length of stringArray is: " + length);In this example, a new string array of length 10 is created using the JNIEnv.NewObjectArray method. The GetArrayLength method is then called to retrieve the length of the array which is then printed to the console. Package library: Java.Interop.