Converting a list of integers into a two-dimensional array in Java
You can use streams:

Object[][] data = studentList.stream()
        .map(studentId -&gt; new Object[]{studentId})
        .toArray(Object[][]::new);