Index: /issm/trunk-jpl/src/android/ISSM/jni/Main.cpp
===================================================================
--- /issm/trunk-jpl/src/android/ISSM/jni/Main.cpp	(revision 13996)
+++ /issm/trunk-jpl/src/android/ISSM/jni/Main.cpp	(revision 13997)
@@ -1,19 +1,39 @@
 #include <jni.h>
 #include "../../../c/android/fac.h"
+#include <cstddef>
+///////////////////////////////////////////////////////////////////////////////////////////
 namespace com_example_issm
 {
-	static jlong factorial(JNIEnv *env, jclass clazz, jlong n)
+	fac* f;
+//------------------------------------------------------------------------------------
+	void initilizeObject(JNIEnv *env, jclass clazz)
 	{
-		fac *f = new fac();
-		jlong result = (jlong) (f->factorial(n));
-		delete(f);
-		return (jlong) result;
+		f = new fac();
 	}
 //------------------------------------------------------------------------------------
-	static JNINativeMethod method_table[] = {
-			{"fac" ,"(J)J" , (void *) factorial},
+	//fill out the first two slots, extract the same way in java using get(int position)
+	void fillBuffer(JNIEnv *env, jclass clazz , jobject buf)
+	{
+		jdouble *bBuf = (jdouble *)env->GetDirectBufferAddress(buf);
+		bBuf[1] = 10.67;
+		bBuf[2] = 100.0;
+	}
+//------------------------------------------------------------------------------------
+	jlong factorial(JNIEnv *env, jclass clazz, jlong n)
+	{
+		if( f != NULL)
+			return (jlong) (f->factorial(n));
+		return 0;
+	}
+
+//------------------------------------------------------------------------------------
+	static JNINativeMethod method_table[] =
+	{
+			{"fac"      	,     "(J)J" 	, (void *) factorial},
+			{"initialize"   ,     "()V" 	, (void *) initilizeObject},
+			{"processBuffer", "(Ljava/nio/DoubleBuffer;)V", (void *) fillBuffer}
 	};
 }
-
+//------------------------------------------------------------------------------------
 using namespace com_example_issm;
 
@@ -29,5 +49,5 @@
     	if(clazz)
     	{
-    		env->RegisterNatives(clazz, method_table, 1);
+    		env->RegisterNatives(clazz, method_table, 3);
     		env->DeleteLocalRef(clazz);
     		return JNI_VERSION_1_6;
@@ -39,2 +59,3 @@
     // Register methods with env->RegisterNatives.
 }
+///////////////////////////////////////////////////////////////////////////////////////////
