Beginner. How to extract vertex position from mesh

How to extract vertex position from mesh
and rewrite them? I want to give vertex position like Vector3f[].
It can be through
mesh.getBuffer(VertexBuffer.Type.Position) and getData(),
but result not is Vector3f. I wrote a completely wrong code:

 Geometry box = new Geometry("Box", new Box(Vector3f.ZERO, 1, 1, 1));
 Geometry box1 = new Geometry ();
 Mesh boxmesh = new Mesh(); 
 boxmesh = box.getMesh();  
 VertexBuffer vb = new VertexBuffer();
 vb = boxmesh.getBuffer(VertexBuffer.Type.Position);
 Buffer buf=vb.getData();
 Object array;
 array = new Object();
 array = buf.array(); // exception

In this example i do this:

Vector3f [] vertices1;
        vertices1=vertices.clone(); // Vector3f [] vertices - handle vertices for all quads
        vertices1[0]=new Vector3f(-1,0,0); // new Vector3f [] 
        cMesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices1)); //modify quad №2

and all quads was changed their vertex positions.

But in this example is not described how extract vertex position from mesh.

Instead of writing the buffer, read it?
Remember the buffer stores a row of floats and not Vector3f instances. So it’s like (x1, y1, z1, x2, y2, z2, x3, y3, z3, …) instead of (vec1, vec2, vec3), if I remember correctly.


At first have not found.

This way you copy all values twice. Simply modifying the buffer directly is probably less overhead.