Read sketch

Hello,i have an arduino uno and a mega 2560 which are connect between them with rf and serial.The problem is that i've lost the code of the sketch and also the code from the uno and the mega after i've formatted my pc.I tried another program which reads the microchip and gives me the code in hex but i couldn't manage to transformed it to the started form.Is there any way to download it from the microchips as i wrote it from the begining?