public int[] mergeChunks(){
  int filledChunks=getFilledChunks();
  int[] merged=new int[size()];
  for (int i=0; i < filledChunks; i++) {
    if (chunks[i] != null) {
      System.arraycopy(chunks[i],0,merged,i * chunkSize,chunkSize);
    }
  }
  int remainder=size() % chunkSize;
  if (remainder != 0 && chunks[filledChunks] != null) {
    System.arraycopy(chunks[filledChunks],0,merged,(filledChunks) * chunkSize,remainder);
  }
  return merged;
}

public int [ ] mergeChunks ( ) { int filledChunks = getFilledChunks ( ) ; int [ ] merged = new int [ size ( ) ] ; for ( int i = 0 ; i < filledChunks ; i ++ ) { if ( chunks [ i ] != null ) { System . arraycopy ( chunks [ i ] , 0 , merged , i * chunkSize , chunkSize ) ; } } int remainder = size ( ) % chunkSize ; if ( remainder != 0 && chunks [ filledChunks ] != null ) { System . arraycopy ( chunks [ filledChunks ] , 0 , merged , ( filledChunks ) * chunkSize , remainder ) ; } return merged ; }
turn this chunked array into a regular int - array , mostly for compatibility cuts off unused space at the end
