Why didn't the us detonate a bomb in an uninhabited area near japan to demonstrate the power of the weapon so that the japanese would surrender without destroying populated cities?
The main reason is that the U.S. only had Enriched Uranium and Plutonium for the two bombs (After the trinity test). A third bomb would take several months or longer to construct. The idea was floated to Truman to demonstrate the 1st bomb as you suggest, but most military advisers told Truman that the Japanese Military hierarchy would be undeterred and want to fight to the finish, along with the fact that we would waste one of our two bombs on the demonstration.
In addition, the testing that had gone on was undoubtedly known of by the Japanese military and Emperor. Whether or not the US planned to use it on a population was a different question.