private int extractPortFromDevice( IDevice device )
    {
        String portStr = StringUtils.substringAfterLast( device.getSerialNumber(), "-" );
        if ( StringUtils.isNotBlank( portStr ) && StringUtils.isNumeric( portStr ) )
        {
            return Integer.parseInt( portStr );
        }

        //If the port is not available then return -1
        return -1;
    }
private int extractPortFromDevice( IDevice device )
    {
        String portStr = StringUtils.substringAfterLast( device.getSerialNumber(), "-" );
        if ( StringUtils.isNotBlank( portStr ) && StringUtils.isNumeric( portStr ) )
        {
            return Integer.parseInt( portStr );
        }

        
        return -1;
    }
private int extractPortFromDevice ( IDevice device ) { String portStr = StringUtils . substringAfterLast ( device . getSerialNumber ( ) , "-" ) ; if ( StringUtils . isNotBlank ( portStr ) && StringUtils . isNumeric ( portStr ) ) { return Integer . parseInt ( portStr ) ; } //If the port is not available then return -1 return - 1 ; }
This method extracts a port number from the serial number of a device.
It assumes that the device name is of format [xxxx-nnnn] where nnnn is the
port number.

@param device The device to extract the port number from.
@return Returns the port number of the device
This method extracts a port number from the serial number of a device . It assumes that the device name is of format [ xxxx - nnnn ] where nnnn is the port number .