 Admiral Nimitz had one priceless advantage : US cryptanalysts had partially broken the Japanese Navy 's JN @-@ <unk> code . Since early 1942 , the US had been decoding messages stating that there would soon be an operation at objective " AF " . It was not known where " AF " was , but Commander Joseph Rochefort and his team at Station HYPO were able to confirm that it was Midway ; Captain Wilfred Holmes devised a ruse of telling the base at Midway ( by secure undersea cable ) to broadcast an uncoded radio message stating that Midway 's water purification system had broken down . Within 24 hours , the code breakers picked up a Japanese message that " AF was short on water . " No Japanese radio operators who intercepted the message seemed concerned that the Americans were broadcasting uncoded that a major naval installation close to the Japanese threat ring was having a water shortage , which could have tipped off Japanese intelligence officers that it was a deliberate attempt at deception . HYPO was also able to determine the date of the attack as either 4 or 5 June , and to provide Nimitz with a complete IJN order of battle . Japan had a new codebook , but its introduction had been delayed , enabling HYPO to read messages for several crucial days ; the new code , which had not yet been cracked , came into use on 24 May , but the important breaks had already been made . 
