code: public void setChainLength(int nrClusters) throws IOException {
          if (nrClusters < 0) throw new IllegalArgumentException(
                  "negative cluster count"); //NOI18N
                  
          if ((this.startCluster == 0) && (nrClusters == 0)) {
              /* nothing to do */
          } else if ((this.startCluster == 0) && (nrClusters > 0)) {
              final long[] chain = fat.allocNew(nrClusters);
              this.startCluster = chain[0];
          } else {
              final long[] chain = fat.getChain(startCluster);
              
              if (nrClusters != chain.length) {
                  if (nrClusters > chain.length) {
                      /* grow the chain */
                      int count = nrClusters - chain.length;
                      
                      while (count > 0) {
                          fat.allocAppend(getStartCluster());
                          count--;
                      }
                  } else {
                      /* shrink the chain */
                      if (nrClusters > 0) {
                          fat.setEof(chain[nrClusters - 1]);
                          for (int i = nrClusters; i < chain.length; i++) {
                              fat.setFree(chain[i]);
                          }
                      } else {
                          for (int i=0; i < chain.length; i++) {
                              fat.setFree(chain[i]);
                          }
                          
                          this.startCluster = 0;
                      }
                  }
              }
          }
      }
docs: Sets the length of this cluster chain in clusters.
  
  @param nrClusters the new number of clusters this chain should contain,
  must be {@code >= 0}
  @throws IOException on error updating the chain length
  @see #setSize(long)