Nothing justifies a massacre. Or war, or any sort of nonconsensual act (I'm asserting here that murdering people en masse is nonconsensual). There's no casus belli that makes war just.
But making shit stop, and stop right now? That can be useful as opposed to just.
Nothing justifies massacre -- except if you can claim that you can make a quick one right now, compared to an 'inevitable' long one, and that trade-off is worth it. (Back to square one)
You say 'all of it is wrong - ALL of it'. It implies it's equally wrong. But then, conveniently, the Japanese attacked first. So defending is kinda right, but of course it's just as wrong as mass murder of civilian populations. So it's kind of like a wrong but right necessary evil.
By most approximations, there were about 200,000 causalities from the bombs and their aftermath.
That said, had the bombs not been dropped, estimates ran into the millions for Allied casualties and tens of millions for Japanese (civilian + soldiers) casualties.
Ultimately it boils down to an issue of numbers (achieved by expediency).