public static int[] convertSelectionToModel(JTable table){
  int[] selected=table.getSelectedRows();
  for (int i=0; i < selected.length; i++) {
    selected[i]=table.convertRowIndexToModel(selected[i]);
  }
  return selected;
}

public static int [ ] convertSelectionToModel ( JTable table ) { int [ ] selected = table . getSelectedRows ( ) ; for ( int i = 0 ; i < selected . length ; i ++ ) { selected [ i ] = table . convertRowIndexToModel ( selected [ i ] ) ; } return selected ; }
converts the selected view indexes to model indexes .
