private FloatBuffer makeInterleavedBuffer(float[] posData,
                                              float[] uvData,
                                              float[] miscData,
                                              int numStars) {

        int dataLength = posData.length
                + uvData.length * numStars
                + miscData.length;

        final FloatBuffer interleavedBuffer = ByteBuffer.allocateDirect(dataLength * Const.BYTES_PER_FLOAT)
                .order(ByteOrder.nativeOrder()).asFloatBuffer();

        int positionOffset = 0, uvOffset = 0, starDataOffset = 0;

        for (int i = 0; i < numStars; i++) {
            for (int v = 0; v < 6; v++) {
                interleavedBuffer.put(posData, positionOffset, ParticleSystem.POS_DATA_SIZE);
                positionOffset += ParticleSystem.POS_DATA_SIZE;

                interleavedBuffer.put(uvData, uvOffset, ParticleSystem.TEXTURE_COORDS_DATA_SIZE);
                uvOffset = (uvOffset + ParticleSystem.TEXTURE_COORDS_DATA_SIZE ) % uvData.length;

                interleavedBuffer.put(miscData, starDataOffset, ParticleSystem.MISC_DATA_SIZE);
                starDataOffset += ParticleSystem.MISC_DATA_SIZE;
            }
        }

        interleavedBuffer.position(0);
        return interleavedBuffer;
    }
Started by Artem Kholodnyi on 11/29/15 6:13 PM -- com.yalantis.starwarsdemo.particlesys
demo/src/main/java/com/yalantis/starwarsdemo/particlesys/ParticlesGenerator.java