Java tutorial
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; public class Main { /** * Creates a {@link IntBuffer} based on the given data. * * @param data the data for the buffer * @return the int buffer */ public static IntBuffer createIntBuffer(final float[] data) { final int[] tmpData = new int[data.length]; for (int i = 0; i < tmpData.length; i++) { tmpData[i] = Float.floatToRawIntBits(data[i]); } final ByteBuffer bbVertices = ByteBuffer.allocateDirect(tmpData.length * 4); bbVertices.order(ByteOrder.nativeOrder()); final IntBuffer intBuffer = bbVertices.asIntBuffer(); intBuffer.put(tmpData); intBuffer.flip(); return intBuffer; } }