BCD码转换成十进制

  private static int IntToBCD(int i) //十进制转BCD
        {
            return (((i / 10) << 4) + ((i % 10) & 0x0f));
        }
        private static int BCDToInt(byte bcd) //BCD转十进制
        {
            return (0xff & (bcd >> 4)) * 10 + (0xf & bcd);
        }
posted on 2011-07-21 10:35  noble_herb  阅读(2174)  评论(0编辑  收藏  举报