Legs (sides other than the hypotenuse) of a right triangle are of lengths 16cm and 8 cm. Find the length of the side of the largest square that can be inscribed in the triangle.