If you want to manipulate it manually here you go
Initialize your variables
ArrayList<String> mainCategory = new ArrayList<>();
ArrayList<String> moderator = new ArrayList<>();
ArrayList<String> subCategory = new ArrayList<>();
ArrayList<ArrayList<ArrayList<String>>> array3d = new ArrayList<>();
ArrayList<ArrayList<String>> array2dFirstRow= new ArrayList<>();
ArrayList<ArrayList<String>> array2dSecondRow= new ArrayList<>();
ArrayList<ArrayList<String>> array2dthirdRow= new ArrayList<>();
ArrayList<String> firstRowFirstColumn = new ArrayList<>();
ArrayList<String> firstRowSecondColumn = new ArrayList<>();
ArrayList<String> secondRowFirstColumn = new ArrayList<>();
ArrayList<String> secondRowSecondColumn = new ArrayList<>();
ArrayList<String> thirdRowFirstColumn = new ArrayList<>();
ArrayList<String> thirdRowSecondColumn = new ArrayList<>();
Construct first 1D inner array[mainCat1, subCat1, subCat2, subCat3]
firstRowFirstColumn.add(mainCategory.get(0));
firstRowFirstColumn.add(subCategory.get(0));
firstRowFirstColumn.add(subCategory.get(1));
firstRowFirstColumn.add(subCategory.get(2));
Construct second 1D inner array[mod1, mod2, mod3, mod4]
firstRowSecondColumn.add(moderator.get(0));
firstRowSecondColumn.add(moderator.get(1));
firstRowSecondColumn.add(moderator.get(2));
firstRowSecondColumn.add(moderator.get(3));
Construct first 2D array [[mainCat1, subCat1, subCat2, subCat3], [mod1, mod2, mod3, mod4]]
array2dFirstRow.add(firstRowFirstColumn);
array2dFirstRow.add(firstRowSecondColumn);
Construct third 1D array [mainCat2, subCat1, subCat2]
secondRowFirstColumn.add(mainCategory.get(1));
secondRowFirstColumn.add(subCategory.get(0));
secondRowFirstColumn.add(subCategory.get(1));
Construct fourth 1D array [mod1, mod2, mod3]
secondRowSecondColumn.add(moderator.get(0));
secondRowSecondColumn.add(moderator.get(1));
secondRowSecondColumn.add(moderator.get(2));
Construct second 2D array [mod1, mod2, mod3]
array2dSecondRow.add(secondRowFirstColumn);
array2dSecondRow.add(secondRowSecondColumn);
Construct 3D array
[
[[mainCat1, subCat1, subCat2, subCat3], [mod1, mod2, mod3, mod4]],
[[mainCat2, subCat1, subCat2], [mod1, mod2, mod3]]
]
array3d.add(array2dFirstRow);
array3d.add(array2dSecondRow);
now you can continue constructing until you end up with the list that you wanted