I need function what print or return only list(not list of list) when if I called her i have
arr1 = [1, 2, [3, 4]];
arr1.flat(); 
// [1, 2, 3, 4]
arr3 = [1, 2, [3, 4, [5, 6]]];
arr3.flat(2);
// [1, 2, 3, 4, 5, 6]
where 2 is number of nested
My Function
public static void included(ArrayList <Object> list) { 
    System.out.print("["); 
    for (int i = 0; i < list.size(); i++) { 
        System.out.print(list.get(i) + " "); 
    } 
    System.out.print("]"); 
}
 
    