Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jfloat to C float

843829Aug 12 2003 — edited Aug 13 2003
Hi, im playing JNI and I send an array of floats from java to my C native function. However when i printf the values of the floats they are not the correct values...what am i doing wrong?

C code:
Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj,jfloatArray arr)
{
jfloat body = (env)->GetFloatArrayElements(env, arr, 0);
aziD = body[0];
eleD = body[1];

printf("After -> Azimuth:%d Elevation:%d\n",aziD,eleD);

(*env)->ReleaseFloatArrayElements(env, arr, body, 0);

return;
}

/////////////////////////////
java values: 1.2 .04
c values: 1073741824 1072902963
//////////////////////////////

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2003
Added on Aug 12 2003
2 comments
831 views