The principle is that the total volume of the metal remains constant when it is melted and reshaped. The volume of the four spheres is equated to the volume of the wire (cylinder).