public static void convertToList(Mesh mesh){
        IndexBuffer inBuf = mesh.getIndicesAsList();
        IndexBuffer outBuf = IndexBuffer.createIndexBuffer(mesh.getVertexCount(),
                                                           inBuf.size());

        for (int i = 0; i < inBuf.size(); i++){
            outBuf.put(i, inBuf.get(i));
        }

        mesh.clearBuffer(Type.Index);
        switch (mesh.getMode()){
            case LineLoop:
            case LineStrip:
                mesh.setMode(Mode.Lines);
                break;
            case TriangleStrip:
            case TriangleFan:
                mesh.setMode(Mode.Triangles);
                break;
            default:
                break;
        }
        mesh.setBuffer(Type.Index, 3, outBuf.getFormat(), outBuf.getBuffer());
    }
<code>WrappedIndexBuffer</code> converts vertex indices from a non list based
mesh mode such as {@link Mode#TriangleStrip} or {@link Mode#LineLoop}
into a list based mode such as {@link Mode#Triangles} or {@link Mode#Lines}.
As it is often more convenient to read vertex data in list format
than in a non-list format, using this class is recommended to avoid
complicating classes used to process mesh data from an external source.

@author Kirill Vainer
jme3-core/src/main/java/com/jme3/scene/mesh/WrappedIndexBuffer.java