Object Position after Rotation

I have group of cubes that rotate about the origin. After each rotation of 90° I want to find the position in 3D space of each cube. How could I go about doing this?

Here is the code I am currently using to draw the cubes:


rotateCubes();
for (Box e : boxes) {
	gl.glPushMatrix();
	gl.glRotatef(angleX, 1, 0, 0);
	gl.glRotatef(angleY, 0, 1, 0);
	gl.glTranslatef(e.getX(), e.getY(), e.getZ());
	e.draw(gl);
	gl.glPopMatrix();
}

The function rotateCubes() manages the values angleX and angleY (the amount of rotation I want). In the code above, I rotate each cube by the correct amount, translate it by the object’s coordinates, and draw it. But the problem is that these coordinates are only valid in reference to each other before any rotations take place. I want to have a second set of coordinates that keep track of each cube’s absolute coordinates in 3D space after each rotation. How could I do this?

Thanks!