### Question:
JTableUtilities { public static int[] convertRowIndicesToModel(JTable table, int[] viewRows) { int[] modelRows = new int[viewRows.length]; for (int index = 0; index < viewRows.length; ++index) { modelRows[index] = table.convertRowIndexToModel(viewRows[index]); } return modelRows; } private  JTableUtilities(); static int[] getSelectedModelRows(JTable table); static int[] convertRowIndicesToModel(JTable table, int[] viewRows); static List<String> getColumnNames(JTable table);  }### Answer:
@Test public void testConvertRowIndicesToModel() { Object[][] data = new Object[3][]; data[0] = new Object[] { "charlie" }; data[1] = new Object[] { "bravo" }; data[2] = new Object[] { "alpha" }; TableModel tableModel = new DefaultTableModel(data, new Object[] { "name" }); JTable table = new JTable(tableModel); table.setRowSorter(new TableRowSorter<TableModel>(tableModel)); int[] indices = new int[] { 0, 1, 2 }; Assert.assertArrayEquals(new int[] { 0, 1, 2 }, JTableUtilities.convertRowIndicesToModel(table, indices)); table.getRowSorter().setSortKeys(Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); Assert.assertArrayEquals(new int[] { 2, 1, 0 }, JTableUtilities.convertRowIndicesToModel(table, indices)); }