A square is inscribed in a right triangle so that they have a common right angle. The legs of the triangle are 6 and 8. Find the length of the side of a square.