In terms of pure numbers, from the projections that were made as to the casualties that would result from dropping nuclear warheads vs. the project number of casualties for an invasion, the warheads were the better choice.
Even more so if you consider the mentality the Japanese culture was bringing to the war.
However, I cannot possibly accept the usage of such weaponry under those circumstances.
America could have simply blocked off Japan from trade in the Pacific, and laid on a sort of national level siege. America did not have to take a "total obliteration" approach to knocking Japan out of the war, especially when it was clear that we were able win and the matter of how America won was a choice that could be made.
I understand it was war, but just because it is such does not mean that you must break your opponent down at whatever cost. Yes, many American soldiers were saved. But that should not have been a necessary issue in the first place, given the many victories that gave America a very strong advantage by that point in the war.
Note: If I remember correctly, did America not push Japan towards war by denying trade for oil and other resources on which Japan depended on America for?