home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for NON-COMMERCIAL purposes and without
- * fee is hereby granted provided that this copyright notice
- * appears in all copies. Please refer to the file "copyright.html"
- * for further important copyright and licensing information.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- */
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include "MyTest.h"
-
- jint Java_MyTest_getIntValue(JNIEnv *env, jobject obj, jarray myarray,
- jarray dblarray) {
-
- int j, val;
- jsize sz;
- int arr[10];
- int *pa;
- jint* parr;
-
-
- sz = (*env)->GetArrayLength(env, myarray);
- printf("Size of int array: %d\n", sz);
- sz = (*env)->GetArrayLength(env, dblarray);
- printf("Size of double array: %d\n", sz);
-
- // get the individual array values //
- parr = (*env)->GetIntArrayElements(env, myarray, 0);
-
- for (j = 0; j< 10; j++) {
- val = (int) *(parr+j);
- printf("Value of array element: %d\n", val);
- }
-
- // change the array values //
- for (j = 0; j<10; j++) {
- parr[j] = 33;
- }
- for (j=0; j<10;j++) {
- val = (int) *(parr+j);
- printf("Value of array element: %d\n", val);
- }
- (*env)->ReleaseIntArrayElements(env,myarray, parr, 0);
- return(j);
- }
-