How to obtain second level domains under the ".uk" ccTLD
<p>I have the ".uk" ccTLD. I want to retrieve the list of all second level domains under it. I tried using a StringBuilder that contains different combinations and lengths of alphabets(for example aa.uk-zz.uk, aaa.uk-zzz.uk)[<strong>code is listed below</strong>]. To test it, I initially planned to use the <strong>Whois</strong> class. But after couple of tests, I obtain "quota exceeded" as a reply. So I discarded this possibility since each IP address is given a certain limit. Is it possible to access and retrieve the list of second level domains of the DNS name server? If so, please instruct me how to do it in java.</p>

<p>`</p>

<p>public class generateDomain {</p>

<pre><code>public static void genDomain(int iDomainLength, String sPredecessor,int iSubLevel) {

    //===========DECLARATIONS==============
    char[] arr_charAlphabets;
    String sDiffcombinations="";
    int[] arr_iPosition;
    int iTotalPossibilities;
    StringBuilder sBuilderComb;
    //==========END OF DECLARATIONS========


    //===========START OF ARRAY BUILDER===================
    //Build an array of characters storing all alphabets
    //a(97)-z(122) - lowercase only
    arr_charAlphabets = new char[26];
    for(int iIterator=97;iIterator&lt;=122;iIterator++){
        arr_charAlphabets[iIterator-97] = (char) iIterator;
    }
    //===========END OF ARRAY BUILDER======================

    //===========START OF TEMPLATE BUILDER=================
    //This portion builds a template of &lt;spaces&gt; and
    //these &lt;spaces&gt; will be replaced with alphabets
    for(int iIterator=1;iIterator&lt;=iDomainLength;iIterator++){
        sDiffcombinations+=" ";
    }
    //===========END OF TEMPLATE BUILDER===================
    sBuilderComb = new StringBuilder(sDiffcombinations);

    arr_iPosition = new int[iDomainLength];
    iTotalPossibilities = (int) Math.pow(26, iDomainLength);


    for (int iIterator1 = 0; iIterator1 &lt; iTotalPossibilities; iIterator1++){

        for (int iIterator2 = 0; iIterator2 &lt; iDomainLength; iIterator2++){

            if (arr_iPosition[iIterator2] == arr_charAlphabets.length){
                arr_iPosition[iIterator2] = 0;
                if (iIterator2 + 1 &lt; iDomainLength) {
                    arr_iPosition[iIterator2 + 1]++;
                }
            }

            sBuilderComb.setCharAt(iIterator2, arr_charAlphabets[arr_iPosition[iIterator2]]);
        }

        arr_iPosition[0]++;
        //======================================================
        System.out.println(sBuilderComb.toString()+sPredecessor);

    }


}

public static void main(String[] args) {
    genDomain(2, ".uk", 1);
    System.out.println("Combinations of length 2 generated");
}
</code></pre>

<p>}</p>

<p>`</p>