Do you want to populate indexes and corresponding pages to TreeMap ?.
Then the answer could be,
1) create a simple map inserting all indexes and corresponding pages to the map.
and use constructor of TreeMap to create a new TreeMap using map as parameter to it.
Map map = new HashMap();
TreeMap treeMap = new TreeMap(map);
It will simply sort your pages according to indexes in ascending order.
please let me know i have answered your question ?