Did they really think they were going to beat the rest of the world? I tried googling it but can't really find a concise answer.
Italy had surrendered long before Germany.
By the time of Germany's surrender (in fact, really since early 1944) the Japanese government's goal was to inflict enough damage on US forces that they would be able to avoid an unconditional surrender. So they were fighting to achieve a partial loss, rather than a total one.