Quick Tip — How to convert a Java jintArray to a C++ std::vector


extern "C" JNIEXPORT jstring JNICALL Java_com_example_project_class_method(JNIEnv *env, jobject /* this */, jintArray arr) {
jsize size = env->GetArrayLength( arr );
std::vector input( size );
env->GetIntArrayRegion( arr, jsize{0}, size, &input[0] );


Interesting links

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Links on erlang/elixir, and their story in brief

Challenges in testing ETL & exploring approaches

Learning C++: Using Sets and Multisets

Build a team that drives your business forward with PeopleForce. Runs on Linode with Cloud 66

BDD Addict Newsletter May 2019

Android Automotive: Build from AOSP

How learning new technologies can be fun!

Otomi Quickstart

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Xavier Jouvenot

Xavier Jouvenot

More from Medium

Debugging basics in Project Reactor

KivaKit — Type Conversion

Reactive Programming with Reactor Library

Oh no, another Java Exceptions Blog post