private void applyGravity() {

        for (int i = 0; i < planets.size(); i++) {
            for (int j = i + 1; j < planets.size(); j++) {
                planets.get(i).applyGravitationalAttraction(planets.get(j));
            }
            planets.get(i).applyGravitationalAttraction(ship);

            for (int a = 0; a < spaceJunk.size(); a++) {
                planets.get(i).applyGravitationalAttraction(spaceJunk.get(a));
            }

            for (int b = 0; b < bullets.size(); b++) {
                planets.get(i).applyGravitationalAttraction(bullets.get(b));
            }
        }

        for (int a = 0; a < spaceJunk.size(); a++) {
            ship.applyGravitationalAttraction(spaceJunk.get(a));
            for (int b = 0; b < bullets.size(); b++) {
                spaceJunk.get(a).applyGravitationalAttraction(bullets.get(b));
            }
        }
    }