如何理解这段程序代码段呢

public class text

{

static int a[] = {1,2,3,4,5,6,7,8,9};

static int n = a.length;

static double all = 10;

static int count = 0;

public static void main(String[] args) {

    perm(0);

    System.out.println(count);

}



public static void perm(int offset){



    if(offset == n-1){

        compare();

        return;

    }

    for(int i= offset; i< n; i++){

        swap(i, offset);

        perm(offset+1);

        swap(i,offset);

    }



}



public static void swap(int i, int offset){

    int temp;



    temp =a[offset];

    a[offset] =a[i];

    a[i] = temp;



}

public static void compare(){

     double number = a[0] + a[1]*1.0/a[2] + (a[3]*100+a[4]*10+a[5])*1.0/(a[6]*100+a[7]*10+a[8]);

     if(Math.abs(number - all) < 0.000001 ){

         count++;

     }



}

}

通读下来的最后输出是count,这是个计数程序。
1.程序进入perm,在这个里面进行for循环,此时offset=0
2.进入swap,将a[i]与a[offset]交换,此时执行递归perm(offset+1)
3.递归n次循环m次之后,得到了count结果

不知道是做什么的程序

1-9任意排序,使得函数a[0] + a[1]*1.0/a[2] + (a[3]*100+a[4]*10+a[5])*1.0/(a[6]*100+a[7]*10+a[8])收敛于10的个数