private static byte reverse(byte v) {
            byte r = 0;
            if ((v & 0x01) != 0)
                r |= 0x80;
            if ((v & 0x02) != 0)
                r |= 0x40;
            if ((v & 0x04) != 0)
                r |= 0x20;
            if ((v & 0x08) != 0)
                r |= 0x10;
            if ((v & 0x10) != 0)
                r |= 0x08;
            if ((v & 0x20) != 0)
                r |= 0x04;
            if ((v & 0x40) != 0)
                r |= 0x02;
            if ((v & 0x80) != 0)
                r |= 0x01;
            return r;
        }