strange behaviour while running tower of hanoi
<p>I am running a very simple program which simulate tower of hanoi.
I print the time taken to move n number (20 to 30) disks.
I see a strange pattern . It takes roughly the same amount of time to move n(even number) and n+1  disks. And to move n+2 disk it takes 4 times of n disks .
I have put the program below. I guess there is some optimization being done in vm when we have multiple recursion calls.
Can anyone put more light on this?</p>

<pre><code>public class Hanoi {
    public static void move(int n) {
        if(n &gt; 0) {           
            move(n-1);
            move(n-1);             
        }
    }

    public static void main(String[] args) {
        int N = 28;
        move(12);
        for(int n=18; n &lt;= N; n++) {
            long start = System.currentTimeMillis();
            move(n);
            long end = System.currentTimeMillis();
            System.out.printf("n=%d t=%d i=%d\n",n, (end-start) , 10);
        }
    }
}
</code></pre>
