msg.append((char)(rest & 0x7f));
msg.append(fromGsmCharset((byte)(rest & 0x7f)));
    public static String readSeptets(InputStream theIs, int theLength)        throws IOException    {        StringBuffer msg = new StringBuffer(160);        int rest = 0;        int restBits = 0;        while(msg.length() < theLength)        {            int data = theIs.read();            if (data == -1)            {                throw new IOException("Unexpected end of stream");            }            rest |= (data << restBits);            restBits += 8;            while (restBits >= 7)            {                msg.append((char)(rest & 0x7f));                rest >>>= 7;                restBits -= 7;            }        } // for        return msg.toString();    }