GrubFatFormatter ff = (GrubFatFormatter)createFormatter();
GrubFatFormatter ff = createFormatter();
	protected void formatDevice(Device device) throws IOException {		/* Format the MBR & partitiontable */				GrubBootSector mbr = (GrubBootSector)(createFormatter().getBootSector());				mbr.getPartition(0).clear();		mbr.getPartition(1).clear();		mbr.getPartition(2).clear();		mbr.getPartition(3).clear();				IBMPartitionTableEntry pte = mbr.getPartition(0);		pte.setBootIndicator(true);		pte.setStartLba(1);		pte.setNrSectors(geom.getTotalSectors() - 1);		pte.setSystemIndicator(IBMPartitionTypes.PARTTYPE_DOS_FAT16_LT32M);		pte.setStartCHS(geom.getCHS(pte.getStartLba()));		pte.setEndCHS(geom.getCHS(pte.getStartLba() + pte.getNrSectors() - 1));				/*System.out.println("partition table:");		for (int i = 0; i < 4; i++) {			System.out.println("" + i + " " + mbr.getPartition(i));		}*/		/* Format partition 0 */		part0 = new MappedBlockDeviceSupport(device, pte.getStartLba() * bytesPerSector, pte.getNrSectors() * bytesPerSector);		GrubFatFormatter ff = (GrubFatFormatter)createFormatter();		ff.setInstallPartition(0x0000FFFF);		ff.format(part0);		GrubBootSector part0bs = (GrubBootSector)ff.getBootSector();  				/* Fixup stage2 sector in MBR */		mbr.setStage2Sector(pte.getStartLba() + part0bs.getStage2Sector());		try {			mbr.write((BlockDeviceAPI)device.getAPI(BlockDeviceAPI.class));		} catch (ApiNotFoundException ex) {			throw new IOException("BlockDeviceAPI not found on device", ex);		}		//System.out.println("mbr stage2 sector=" + mbr.getStage2Sector());	}