It seems to me that there was less justification for Hiroshima than for Gaza.
Japan was no longer any threat to the US at the end of WWII from thousands of miles away and we could have just blockaded them forever. By contrast here were still a gazillion terrorists right next door to Israel in Gaza hiding behind civilians after October 6th.