My understanding is nukes were the main reason. They also likely saved millions of japanese from dying of starvation - saved far more japanese than they killed (to say nothing of allied casualties averted).