You do realize Japan received warning before the bombs fell, right? And not just the nukes: The U.S. govt. told them to surrender or face destruction. Japan brought the devastation on themselves.
An invasion of Japan would have cost up to tens of millions of lives. Do you think wiping Japan out to end the war was a better idea?