Was the United States justified for the bombing of Hiroshima and Nagasaki?

Was the United States justified for the bombing of Hiroshima and Nagasaki?