I'm not sure. The Japs didn't stop cause of nukes afaik (Hirohito was still in a "fuck the yanks, die for honor" school of thought), what ended the war was the fact the Soviet peace pact with them had ended at about that time and the Russkies didn't give them so much as a how do you do before just saying "war time again", being left with no realistic threat in Europe with the Germany out of the picture. With the threat of the Soviet Union on top of everything else, the Japanese didn't have anywhere to go or anything to hope for and that's what really ended the war.
If you put the Russkies aside, the deal is tricky. Some predict the losses from the invasion of Japan would've been well over a million (I believe the nukes hit for about 80k people each or so, radiation deaths counted). Now, my concern is for the civilians first of course and nukes being dropped on them was CERTAINLY not the right move, but when you weigh a million against about 150k, as ugly as the math is, it's an easy choice for someone who's job it is to worry about their own troops and people.
With the Russkies in the picture however, it's a lot more complicated. Perhaps the war could've ended diplomatically by using the Soviet Union as leverage and convincing the Japanese there's just nothing to fight for anymore. If push came to shove, dropping a nuke on a strictly military objective (f. ex. perhaps a naval target within the visual range of coastal troops to witness first hand the power of the bombs) could've demonstrated the same message of power and pushed the same feeling of hopelessness as Hiroshima and Nagasaki did, just minus the tens of thousands innocent civilians.
Honestly, as numerically as I appreciate looking at things, just dropping two bombs (what does a second one do that the first one didn't?) on vastly civilian areas is very hardly justifiable. As some last resort, ok, I might be able to swallow it, but I really don't think the war was at that point at the time at all, imo, it was just a rushed decision to demonstrate the first out of many "don't fuck with America" military actions.