Why was the Atomic Bomb Used?

The atomic bomb was used by the United States forces on Hiroshima and Nagasaki, Japan as a means of bringing an immediate end to World War II. It worked, but at the cost of allot of lives.