in src/main/c/h3-java/src/jniapi.c [1420:1443]
JNIEXPORT void JNICALL Java_com_uber_h3core_NativeMethods_vertexToLatLng(
JNIEnv *env, jobject thiz, jlong h3, jdoubleArray latLng) {
LatLng coord;
H3Error err = vertexToLatLng(h3, &coord);
if (err) {
ThrowH3Exception(env, err);
return;
}
jsize sz = (**env).GetArrayLength(env, latLng);
jdouble *coordsElements = (**env).GetDoubleArrayElements(env, latLng, 0);
if (coordsElements != NULL) {
// if sz is too small, we will fail to write all the elements
if (sz >= 2) {
coordsElements[0] = coord.lat;
coordsElements[1] = coord.lng;
}
(**env).ReleaseDoubleArrayElements(env, latLng, coordsElements, 0);
} else {
ThrowOutOfMemoryError(env);
}
}