public void createTree(int n, int k){
        if(Integer.bitCount(k) != 1)
        {
            System.err.println("number of parts must be a power of 2");
            System.exit(-1);
        }
        
        // get the maximum number of links that can be stored
        boolean failed = true;
        double maxLinks = 0d;
        while(failed)
        {
            maxLinks = 0d;
            failed = false;
            for(socketHandler h : socketHandlers)
            {
                if(h.maxSize < 0)
                {
                    failed = true;
                }
                maxLinks += h.maxSize;
            }
        }
        System.out.println("Maximum number of links I can store: " + maxLinks);
        int nodesPerPart = (int) Math.floor((double)n/(double)(k));
        int l = 0;
        int u = l + (int)Math.floor((((double)socketHandlers[0].maxSize)/maxLinks) * (double)n);
        int[][] b = new int[k][2]; 
        for(int i=0;i<k-1;i++)
        {
            b[i][0] = l;
            b[i][1] = u;
            l = u + 1;
            u = l + (int)Math.floor((((double)socketHandlers[i+1].maxSize)/maxLinks) * (double)n);
        }
        u = n;
        b[k-1][0] = l;
        b[k-1][1] = u;
        // creates the tree recursively with T being the centre part
        T = getPartLinkSet(b,k/2,k/4);
        System.exit(2);
    }