code: protected void moveElements(HeaderIndexFile<Data> source, RangeHashFunction targetHashfunction, String workingDir)
              throws IOException, FileLockException {
          ByteBuffer elem = ByteBuffer.allocate(source.getElementSize());
          HeaderIndexFile<Data> tmp = null;
          newBucketIds = new IntArrayList();
          long offset = 0;
          byte[] key = new byte[gp.getKeySize()];
          int oldBucket = -1, newBucket;
          while (offset < source.getFilledUpFromContentStart()) {
              source.read(offset, elem);
              elem.rewind();
              elem.get(key);
  
              newBucket = targetHashfunction.getBucketId(key);
              if (newBucket != oldBucket) {
                  this.newBucketIds.add(newBucket);
                  if (tmp != null) {
                      tmp.close();
                  }
                  String fileName = workingDir + "/" + targetHashfunction.getFilename(newBucket);
                  tmp = new HeaderIndexFile<Data>(fileName, AccessMode.READ_WRITE, 100, gp);
                  oldBucket = newBucket;
              }
  
              tmp.append(elem);
              offset += elem.limit();
          }
          if (tmp != null)
              tmp.close();
      }
docs: moves elements from the source file to new smaller files. The filenames are generated automatically
  
  @param source
  @param targetHashfunction
  @param workingDir
  @throws IOException
  @throws FileLockException