static int[] sortUnique(int[] list){
  Arrays.sort(list);
  int count=1;
  for (int i=1; i < list.length; i++) {
    if (list[i] != list[i - 1]) {
      count++;
    }
  }
  int[] ret=new int[count];
  count=1;
  ret[0]=list[0];
  for (int i=1; i < list.length; i++) {
    if (list[i] != list[i - 1]) {
      ret[count++]=list[i];
    }
  }
  return ret;
}

static int [ ] sortUnique ( int [ ] list ) { Arrays . sort ( list ) ; int count = 1 ; for ( int i = 1 ; i < list . length ; i ++ ) { if ( list [ i ] != list [ i - 1 ] ) { count ++ ; } } int [ ] ret = new int [ count ] ; count = 1 ; ret [ 0 ] = list [ 0 ] ; for ( int i = 1 ; i < list . length ; i ++ ) { if ( list [ i ] != list [ i - 1 ] ) { ret [ count ++ ] = list [ i ] ; } } return ret ; }
sort a list of integers and remove duplicates
