}catch (IOException ioe) { throw new FileSystemException("Unable to create filesystem", ioe); }  }
for (int i = 0; i < groupCount; i++) { log.debug("creating gropup " + i);  byte[] blockBitmap = new byte[blockSize]; byte[] inodeBitmap = new byte[blockSize];   long iNodeTableBlock = groupDescriptors[i].getInodeTable(); long firstNonMetadataBlock = iNodeTableBlock + INodeTable.getSizeInBlocks(this); int metadataLength = (int) (firstNonMetadataBlock - (superblock .getFirstDataBlock() + i * superblock.getBlocksPerGroup())); for (int j = 0; j < metadataLength; j++) BlockBitmap.setBit(blockBitmap, j);   if (i == groupCount - 1) { for (long k = superblock.getBlocksCount(); k < groupCount * superblock.getBlocksPerGroup(); k++) BlockBitmap.setBit(blockBitmap, (int) (k % superblock .getBlocksPerGroup())); }    if (i == 0) for (int j = 0; j < superblock.getFirstInode() - 1; j++) INodeBitmap.setBit(inodeBitmap, j);   byte[] emptyBlock = new byte[blockSize]; for (long j = iNodeTableBlock; j < firstNonMetadataBlock; j++) writeBlock(j, emptyBlock, false);  iNodeTables[i] = new INodeTable(this, (int) iNodeTableBlock);  writeBlock(groupDescriptors[i].getBlockBitmap(), blockBitmap, false); writeBlock(groupDescriptors[i].getInodeBitmap(), inodeBitmap, false); }  log.info("superblock.getBlockSize(): " + superblock.getBlockSize());  buildRootEntry();   flush();  } catch (IOException ioe) { throw new FileSystemException("Unable to create filesystem", ioe); }  }
	public void create(int blockSize) throws FileSystemException {		try{			//create the superblock			superblock = new Superblock();			superblock.create(blockSize, this);						//create the group descriptors			groupCount = (int)Math.ceil((double)superblock.getBlocksCount() / (double)superblock.getBlocksPerGroup());			groupDescriptors = new GroupDescriptor[groupCount];			iNodeTables = new INodeTable[groupCount];									for(int i=0; i<groupCount; i++) {				groupDescriptors[i]=new GroupDescriptor();				groupDescriptors[i].create(i, this);			}						//create each block group:			//	create the block bitmap			//	create the inode bitmap			//	fill the inode table with zeroes			for(int i=0; i<groupCount; i++) {				log.debug("creating gropup "+i);								byte[] blockBitmap = new byte[blockSize];				byte[] inodeBitmap = new byte[blockSize];							//update the block bitmap: mark the metadata blocks allocated				long iNodeTableBlock = 	groupDescriptors[i].getInodeTable();				long firstNonMetadataBlock = iNodeTableBlock + INodeTable.getSizeInBlocks(this);				int  metadataLength  = (int)(firstNonMetadataBlock - 										(superblock.getFirstDataBlock() + i*superblock.getBlocksPerGroup()));				for(int j=0; j<metadataLength; j++)					BlockBitmap.setBit(blockBitmap, j);								//set the padding at the end of the last block group				if(i == groupCount-1) {					for(long k=superblock.getBlocksCount(); k<groupCount*superblock.getBlocksPerGroup(); k++)						BlockBitmap.setBit(blockBitmap,(int) (k % superblock.getBlocksPerGroup()));				}									//update the inode bitmap: mark the special inodes allocated in the first block group				if(i==0)					for(int j=0; j<superblock.getFirstInode()-1; j++)						INodeBitmap.setBit(inodeBitmap, j);								//create an empty inode table				byte[] emptyBlock = new byte[blockSize];				for(long j=iNodeTableBlock; j<firstNonMetadataBlock; j++)					writeBlock(j, emptyBlock, false);													iNodeTables[i] = new INodeTable(this, (int)iNodeTableBlock);				writeBlock(groupDescriptors[i].getBlockBitmap(), blockBitmap, false);				writeBlock(groupDescriptors[i].getInodeBitmap(), inodeBitmap, false);						}						log.info("superblock.getBlockSize(): "+superblock.getBlockSize());			buildRootEntry();						//write everything to disk			flush();		}catch (IOException ioe) {			throw new FileSystemException("Unable to create filesystem", ioe);		}			}