Height map collision

Morning

I started with my first attempt to create and render randomly genarated height maps with LWJGL.
The heightmap is rendered using triangle strips from BufferedImage genarated from Perlin noise.
I can fly over the terrain and parse through it, but now I want to implement collision detection
so that the camera always stays at a fixed height above the ground.

My camera holds a vector3 (x,y,z) for the position in 3D space and my height map stores a 2D array of height values. When i render the map i have a nested for loop that places a vertices where the need to be.


for (int z = 0; z < values.length - 1; z++) {
     GL11.glBegin(GL_TRIANGLE_STRIP);
     for (int x = 0; x < values[z].length; x++) {
          GL11.glVertex3f(x, values[z][x], z);
          GL11.glVertex3f(x, values[z + 1][x], z + 1);
     }
     GL11.glEnd();
     GL11.glFlush();
}

the way is thought of doing is having a boolean method that returns whether I point is below the height map and there just translate the camera until its position is no longer below the map. (hope this makes sense)


// like this or somthing similar
while (map.isBelow(camera.getPosition())) {
     camera.translate(0, 1, 0);
}

is there any way to do this, assuming this is the best way and if not what is the best way?

thanks in advance,
siD