I am passing a jbyte variable to a function in c inside the android NDK C file. I want to convert this byte variable to int. How to do that?
try this
char buf[512];
jint dest_size = env->GetArrayLength(ba);
if (dest_size < sizeof(buf)) {
jbyte* dest_data = env->GetByteArrayElements(ba, NULL);
if (NULL != dest_data) {
memset(buf, 0x00, sizeof(buf));
memcpy(buf, dest_data, (int)dest_size);
// use buffer here
env->ReleaseByteArrayElements(ba, dest_data, 0);
}