title: NDK, work with FloatBuffer as parameter
body: <p>I'm working with NDK and native buffer. I have the following code:</p>
  
  <p>Java class definition with native method:</p>
  
  <pre><code>public class MyNDK {
  
      static {
          System.loadLibrary("MyLibrary");
      }
  
      public native void workWithFloatBuffer(FloatBuffer buffer, int base, int size);
  
  }
  </code></pre>
  
  <p>Native code implementation (i have test its definition and it's ok):</p>
  
  <pre><code>JNIEXPORT void JNICALL Java_com_example_xcesco_myapplication_MyNDK_workWithFloatBuffer(JNIEnv *env, jobject object, jobject input, jint base, jint size)
  {
      jfloat *buffer =(jfloat *) env-&gt;GetDirectBufferAddress(input);
  
      for (int i=base;i&lt;size;i++)
      {
          buffer[i]=i*2.0f;
      }
  }
  </code></pre>
  
  <p>And the code used in an activity to test the result:</p>
  
  <pre><code>    FloatBuffer buffer= ByteBuffer.allocateDirect(4*10).asFloatBuffer();
      (new MyNDK()).workWithFloatBuffer(buffer, 0,4);
  
      for (int i=0; i&lt; 4;i++) {
          Log.i("BLA", "value["+i+"]="+buffer.get(i));
      }
  </code></pre>
  
  <p>Current result on log is:</p>
  
  <pre><code>value[0]=0.0
  value[1]=9.0E-44
  value[2]=4.6007E-41
  value[3]=6.8966E-41
  </code></pre>
  
  <p>That's very different from the aspected result of</p>
  
  <pre><code>value[0]=0.0
  value[1]=2
  value[2]=4
  value[3]=6
  </code></pre>
  
  <p>What's it wrong? </p>