code: @SuppressWarnings({"rawtypes","unchecked"})
      public static void copyRowsToTable(Selection rows, Table oldTable, Table newTable) {
          for (int columnIndex = 0; columnIndex < oldTable.columnCount(); columnIndex++) {
              Column oldColumn = oldTable.column(columnIndex);
              int r = 0;
              for (int i : rows) {
                  newTable.column(columnIndex).set(r, oldColumn, i);
                  r++;
              }
          }
  
      }
docs: Copies the rows indicated by the row index values in the given selection from oldTable to newTable