static private short atos(byte[] in, int fromIndex, int byteLen)
    {
        int i = fromIndex;
        int endIndex = i + byteLen;
        int sign = 1;
        int r = 0;

        while (i < endIndex && Character.isWhitespace((char)in[i]))
        {
            i++;
        }

        if (i < endIndex && in[i] == '-')
        {
            sign = -1;
            i++;
        }
        else if (i < endIndex && in[i] == '+')
        {
            i++;
        }

        while (i < endIndex)
        {
            char ch = (char)in[i];
            if ('0' <= ch && ch < '0' + 1)
                r = r * 10 + ch - '0';
            i++;
        }
        return (short)(r * sign);
    }