[Solved] Randomly Generated Objects that do not Overlap?

  What I'm trying to accomplish is to have planets with randomly generated positions, but are at least 400 pixels away from each other. In the code below what I'm trying to do is create an object, iterate through the whole list making sure none of the objects collide, and if so set a new position and check again. All that nonsense that starts with Math.sqrt is the distance formula so that I can check how far away it is. The code below is also NOT in an infinite loop, it is done upon creation of another object.
for (int i = 0; i < 300; i++) {
			planetList.add(new Planet(
					rand.nextInt(40000 - (0 - 40000) + 1) + 0 - 40000, rand
							.nextInt(40000 - (0 - 40000) + 1) + 0 - 40000, PlanetSelect,
					planetWhiteRegion, planetGreenRegion, planetRedRegion));

			for (Iterator<Planet> planetIter = planetList.iterator(); planetIter
					.hasNext();) {
				Planet planet = planetIter.next();

				if (Math.sqrt(planetList.get(i).getX() - planet.getX())
						* (planetList.get(i).getX() - planet.getX())
						+ (planetList.get(i).getY() - planet.getY())
						* (planetList.get(i).getY() - planet.getY()) < 400) {

					planetList.get(i).setPosition(
							rand.nextInt(40000 - (0 - 40000) + 1) + 0 - 40000,
							rand.nextInt(40000 - (0 - 40000) + 1) + 0 - 40000);
					}
				}
			}