if(!(dev.getDriver() instanceof FSBlockDeviceAPI)){ throw new FileSystemException( "Unsupported device by format command");  }
    public static void main(String[] args) throws SyntaxErrorException {        try {            ParsedArguments cmdLine = HELP_INFO.parse(args);            String device = ARG_DEVICE.getValue(cmdLine);            String FSType = FS.getValue(cmdLine).intern();            Integer bsize;            try {                bsize = Integer.valueOf(BS_VAL.getValue(cmdLine));            } catch (NumberFormatException nfe) {                bsize = new Integer(4);            }            String fsTypeName;            Object params;            int fatSize = 0;            if (FSType == "fat16") {                fatSize = Fat.FAT16;                fsTypeName = FatFileSystemType.NAME;                params = new Integer(fatSize);            } else if (FSType == "fat12") {                fatSize = Fat.FAT12;                fsTypeName = FatFileSystemType.NAME;                params = new Integer(fatSize);            } else if (FSType == "ext2") {                fsTypeName = Ext2FileSystemType.NAME;                params = bsize;            } else                throw new FileSystemException(                        "Unsupported FS by format command");            DeviceManager dm;            dm = InitialNaming.lookup(DeviceManager.NAME);            Device dev = dm.getDevice(device);            FileSystemService fileSystemService = InitialNaming                    .lookup(FileSystemService.NAME);            FileSystemType type = fileSystemService                    .getFileSystemTypeForNameSystemTypes(fsTypeName);            type.format(dev, params);            // restart the device            dm.stop(dev);            dm.start(dev);        } catch (NameNotFoundException e) {            e.printStackTrace();        } catch (DeviceNotFoundException e) {            e.printStackTrace();        } catch (DriverException e) {            e.printStackTrace();        } catch (FileSystemException e) {            //             e.printStackTrace();        }    }