how to get a precise div using jsoup

i've a problem with selecting a specific child by order , for exemple looking at this html code :

        <div class="partA">
        <div class="partB">
        <div class="partC">
        <div class="partB">
        <div class = "sublassB"> 5 </div>

        <div class="partD">

i want using jsoup , get the fourth div for example (body/div[4]/div[5]) , and then get the class name of the fourth div .

i used :eq(n) but it didnt give me the disered result . is there any other way ? thanks in advance :) .

Getting elements with classname is always preferred but still if you want to go by index numbering you can use below code , you must know exact index you want to fetch though

Document doc = Jsoup.connect("").get();
Elements body="body").get(0);
Elements  div ="div").get(3).select("div").get(4); // here just append select("div").get(n) fi you know exact nesting and div number you want 

System.out.println(div.attr("class")) // this will give you classname