Right, this is where things get complicated and slow. This means that the time taken to process the movement of the stars is proportional to the square of the number of stars. So, double the number of stars, and it can take four times longer to calculate.
Every star is attracted to every other by a force which lessens with distance.
The force is also affected by the mass of each star. You may notice that the above loop is slightly innefficient. Twice the necessary number of comparisons are done. Say you had two stars. That code would compare star 1 to star 2, then compare star 2 to star 1.