public int[] mergeAllChunks(){
  int[] merged=new int[chunkSize * numChunks];
  int filledChunks=Math.min(numChunks,getFilledChunks() + 1);
  for (int i=0; i < filledChunks; i++) {
    if (chunks[i] != null) {
      System.arraycopy(chunks[i],0,merged,i * chunkSize,chunkSize);
    }
  }
  if (defaultValue != 0)   Arrays.fill(merged,size(),merged.length,defaultValue);
  return merged;
}

public int [ ] mergeAllChunks ( ) { int [ ] merged = new int [ chunkSize * numChunks ] ; int filledChunks = Math . min ( numChunks , getFilledChunks ( ) + 1 ) ; for ( int i = 0 ; i < filledChunks ; i ++ ) { if ( chunks [ i ] != null ) { System . arraycopy ( chunks [ i ] , 0 , merged , i * chunkSize , chunkSize ) ; } } if ( defaultValue != 0 ) Arrays . fill ( merged , size ( ) , merged . length , defaultValue ) ; return merged ; }
turn this chunked array into a regular int - array , mostly for compatibility also copying unused space at the end filled with default value
