public HashMap<String, Integer> printCheck(Check check) throws Exception
    {
        HashMap<String, Integer> result = new HashMap<String, Integer>();

        if ( ! check.validate())
            throw new Exception("Ошибка заполнения чека");

        int command = check.getCommand();

        ArrayList<Integer> answer = this.device.send(0x8D, 5, new char[]{(char)check.getType()});

        if (answer.get(0) != Status.OK)
            throw new Exception("Ошибка открытия чека");

        int products_count = check.getProductsCount();

        for(int i = 0; i < products_count; i++)
        {
            String title = check.getProduct(i).title;

            if (title.length() > 39)
            {
                this.printLongString(2, 39, title);
                check.getProduct(i).title = "";
            }

            answer = device.send(command, 3, check.getProduct(i).getSaleParams());

            if (answer.get(0) != Status.OK)
                throw new Exception("Ошибка продажи товара");
        }

        answer = device.send(0x85, 5, check.getCloseParams());

        if (answer.get(0) != Status.OK)
            throw new Exception("Ошибка закрытия чека");

        result.put("result", answer.get(0));

        if (answer.get(0) == Status.OK)
        {
            if (answer.size() > 1)
            {
                result.put("error_code", answer.get(4));
                result.put("operator", answer.get(5));
            }
        }

        return result;
    }