当前位置:编程学习 > C#/ASP.NET >>

把两个字节的十六进制转换为十进制

  如题: 
 Private mBuffer(MAXBUFFER) As Byte
 Dim buf As Byte() = New Byte() {mBuffer(8), mBuffer(9)}
 在mbuffer数组中 有两个字节的16进制值   
 mBuffer(8)=0x10
 mBuffer(9)=0x78
要将这两个值转换成int类型的十进制值

如果高低位要进行互换又该怎么算? --------------------编程问答--------------------         Dim mBuffer(9) As Byte
        Dim i As Short
        mBuffer(8) = &H10
        mBuffer(9) = &H78
        i = BitConverter.ToInt16(mBuffer, 8)
        MsgBox(i)
        Dim buf As Byte() = BitConverter.GetBytes(i)
        i = BitConverter.ToInt16(buf, 0)
        MsgBox(i) --------------------编程问答-------------------- msgbox &H10
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,