The war with Germany had ended with the takinig over in Berlin in 1945.
However the Japanese continued to put fierce resistance on the Pacific islands. According to their culture , surrender was never an option so they were convienced that, even if the war was lost , they needed to die in battle as an act of honor and loyalty to the Emperor.
Some battles reported an enourmous amount of casualities, like the battle of Iwo Jima, in late 1945, even thought that a conventional war was carried to expel the Imperial armies that ocuppied key strategic islands, this would represent a huge amount of lives to both sides.
The decision made by H Truman in using the atomic bomb was later criticized but it indeed led to a former surrender of the Japanese that would other means would eagerly set defense on Japan mainland.
The use of atomic boms was later criticized and by public opnion often considered a war crime. There is a lot of disagreemnt since it was the first time this ever happend in history of humankind. As civilians died together with a destruction of all kind of life this continous to be debated in academic circles.