for (int pi = 0; pi < paras.length(); pi++) { checksum += paras.charAt(pi) & HEXFF;
for (int pi = 0; pi < paras.length(); pi += 2) { checksum += (paras.charAt(pi) & HEXFF) << EIGHT; checksum += paras.charAt(pi + 1) & HEXFF;
    void generateGsParaString(OutputStream wtr, String body) throws IOException {        byte[] gsheader = new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                      0x00, 0x00, 0x00, 0x00, CR, LF, CR, LF};        StringBuffer paras = new StringBuffer();                String serial = getSerialNumber();                for (int si = 0; si < SIX; si++) {            gsheader[si + SIX] = (byte) Integer.parseInt(serial.substring(si * 2, si * 2 + 2), SIXTEEN);        }                paras.append(body);        paras.append("gnkey=0b82");        if (paras.length() % 2 == 1) {            paras.append('\000');        }        int plen = paras.length() / 2;        gsheader[2] = (byte) ((plen >> EIGHT) & HEXFF);        gsheader[KOLME] = (byte) (plen & HEXFF);        int checksum = 0;        for (int pi = 0; pi < paras.length(); pi++) {            checksum += paras.charAt(pi) & HEXFF;        }        for (int pi = 0; pi < SIXTEEN; pi++) {            checksum += gsheader[pi] & HEXFF;        }        checksum = OXIOOOO - checksum;        gsheader[FOUR] = (byte) ((checksum >> EIGHT) & HEXFF);        gsheader[VIISI] = (byte) (checksum & HEXFF);        wtr.write(gsheader);        wtr.write(paras.toString().getBytes());    }