Here you can find the source of wrap(float[] buffer)
public static FloatBuffer wrap(float[] buffer)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.ShortBuffer; public class Main { public static FloatBuffer wrap(float[] buffer) { return (FloatBuffer) ByteBuffer.allocateDirect(buffer.length * 4) .order(ByteOrder.nativeOrder()).asFloatBuffer().put(buffer) .position(0);/*from www. j a va 2s.c om*/ } public static ShortBuffer wrap(short[] buffer) { return (ShortBuffer) ByteBuffer.allocateDirect(buffer.length * 2) .order(ByteOrder.nativeOrder()).asShortBuffer().put(buffer) .position(0); } }