How to get vertices from a mesh?

I’m just trying to loop through the vertices in a mesh so I can output them to a file. Does anyone know how to do this?

there might be a better way but you can use this to get the position vertices as an array:

[java]Vector3f[] vertexArray = BufferUtils.getVector3Array(geom.getMesh().getFloatBuffer(VertexBuffer.Type.Position)); [/java]

Thanks!