public class Simulator
{
    public static final String DATA_FILE = "data.txt";
    public static final int ITERATIONS = 1000;
    public static final void main (String[] args)
    {
        boolean debug = false;
        boolean verify = false;

        for (int i = 0; i < args.length; i++)
        {
            if ("-help".equals(args[i]))
            {
                System.out.println("Usage: [-debug] [-verify]");
                System.exit(0);
            }

            if ("-debug".equals(args[i]))
                debug = true;

            if ("-verify".equals(args[i]))
                verify = true;
        }

        if (verify)
        {
            Verifier theVerifier = new Verifier(debug);

            if (theVerifier.verify())
                System.out.println("Verified ok!");
            else
                System.out.println("Verify failed!");

            System.exit(0);
        }

        MoonSystem theMoons = new MoonSystem(DATA_FILE, debug);

        for (int i = 0; i < ITERATIONS; i++)
        {
            theMoons.applyGravity();
        }

        System.out.println("Total energy after "+ITERATIONS+" iteratiosn: "+theMoons.totalEnergy());
    }
}
@@ -77,55 +77,8 @@
 t%22;%0A
-    public static final int ITERATIONS = 1000;%0A
     
@@ -926,25 +926,24 @@
 debug);%0A
-%0A
         
 for (int
@@ -938,89 +938,120 @@
     
-for (int i = 0; i %3C ITERATIONS; i++)%0A        %7B%0A            theMoons.applyGravity(
+long%5B%5D periods = theMoons.periodicity();%0A        long timeToRepeat = Util.lcm(periods%5B0%5D, periods%5B1%5D, periods%5B2%5D
 );%0A 
@@ -1049,34 +1049,32 @@
 ds%5B2%5D);%0A        
-%7D%0A
 %0A        System.
@@ -1090,78 +1090,72 @@
 ln(%22
-Total energy after %22+ITERATIONS+%22 iteratiosn: %22+theMoons.totalEnergy()
+It will take %22+timeToRepeat+%22 steps to reach a repeating state.%22
 );%0A 

Update Simulator.java