Java examples for java.nio:FloatBuffer
Copy FloatBuffer
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { public static FloatBuffer CopyFloatBuffer(FloatBuffer data) { FloatBuffer copy = ByteBuffer.allocateDirect(4 * data.capacity()) .order(ByteOrder.nativeOrder()).asFloatBuffer(); for (int i = 0; i < data.capacity(); i++) { copy.put(i, data.get(i));/*from w w w . j av a 2 s.c o m*/ } return copy; } }