I believe the US (along with every country) had (and still has, should the occasion rise) the right to flatten an area full of a population that was perfectly willing to take up arms against an occupying force. Under these circumstances, the "civilian" population should no longer be treated as "non-combatants" and instead should be considered "hostile militia". From this viewpoint, Hiroshima and Nagasaki were barracks housing large numbers of enemy combatants and thus their elimination, necessary or not, was justified. And to be honest, the US flattened two cities to save the civilian population of an ENTIRE country the pain of war right outside their homes and also avoided additional US casualties.
That's a tricky thing that directly relates to politics and values when you're talking about populations hostile to an occupying force because all sorts of issues come up as to why the occupying force is there and why is the population hostile.
This ultimately becomes a question of what justifies straight out genocide, colonization, regression of a country/people's development ('bombing back to the stone age'), or forced migration (expect people who are being attacked to sit still?). Simple occupation which doesn't attempt to permanently reshape the occupied population in some way almost never happens because then there is no point in occupying.
In the WW2 case of Japan, they were the aggressors being beaten back but refusing to cease hostilities, so I can see the justification. What about Palestinians resisting Israeli occupation? Israel was founded with Jewish terrorist threats and attacks on Palestinians living there at the time to make them move away. The Israeli government and armed Jewish settlers continue to take over land where Palestinians still live and constantly destroy Palestinian crops and buildings to suppress their development. The Palestinians have responded in all sorts of ways ranging from protests to terrorist attacks to full scale war when supported by other countries. Would Israel be justified in wiping out the Palestinians?