case '1': bcd |= 0x01; break; case '2': bcd |= 0x02; break; case '3': bcd |= 0x03; break; case '4': bcd |= 0x04; break; case '5': bcd |= 0x05; break; case '6': bcd |= 0x06; break; case '7': bcd |= 0x07; break; case '8': bcd |= 0x08; break; case '9': bcd |= 0x09; break; case '*': bcd |= 0x0A; break; case '#': bcd |= 0x0B; break; case 'a': bcd |= 0x0C; break; case 'b': bcd |= 0x0E; break;
case '1': bcd |= 0x10; break; case '2': bcd |= 0x20; break; case '3': bcd |= 0x30; break; case '4': bcd |= 0x40; break; case '5': bcd |= 0x50; break; case '6': bcd |= 0x60; break; case '7': bcd |= 0x70; break; case '8': bcd |= 0x80; break; case '9': bcd |= 0x90; break; case '*': bcd |= 0xA0; break; case '#': bcd |= 0xB0; break; case 'a': bcd |= 0xC0; break; case 'b': bcd |= 0xE0; break;
    public static void writeBcdNumber(OutputStream theOs, String theNumber)        throws IOException    {        int bcd = 0x00;        int n = 0;        // First convert to a "half octet" value        for(int i=0; i < theNumber.length(); i++)        {            switch(theNumber.charAt(i))            {            case '0': bcd |= 0x00; break;            case '1': bcd |= 0x01; break;            case '2': bcd |= 0x02; break;            case '3': bcd |= 0x03; break;            case '4': bcd |= 0x04; break;            case '5': bcd |= 0x05; break;            case '6': bcd |= 0x06; break;            case '7': bcd |= 0x07; break;            case '8': bcd |= 0x08; break;            case '9': bcd |= 0x09; break;            case '*': bcd |= 0x0A; break;            case '#': bcd |= 0x0B; break;            case 'a': bcd |= 0x0C; break;            case 'b': bcd |= 0x0E; break;            }            n++;            if (n == 2)            {                theOs.write(bcd);                n = 0;                bcd = 0x00;            }            else            {                bcd <<= 4;            }        }        if (n == 1)        {            bcd |= 0xF0;            theOs.write(bcd);        }    }