#include "TestParams.h" #include #include JNIEXPORT jint JNICALL Java_TestParams_factorial (JNIEnv * env, jobject obj, jint i) { jint j, k; printf ("Inside C: integer parameter i = %3d\n", i); j = i; k = 1; while (j != 1) { k = k * j; j = j - 1; } printf ("Inside C: factorial k = %3d\n", k); return k; } JNIEXPORT jstring JNICALL Java_TestParams_replicate (JNIEnv * env, jobject obj, jstring s) { const char *s2, *s2_copy, *s3; jboolean copy; jstring s4; copy = JNI_TRUE; s2 = (*env)->GetStringUTFChars (env, s, ©); s2_copy = (*env)->GetStringUTFChars (env, s, ©); printf ("Inside C: replicate String = %s\n", s2); s3 = strcat (s2, s2_copy); s4 = (*env)->NewStringUTF (env, s2); printf ("Inside C: replicate return value = %s\n", s3); return s4; }