我有一个包含两个值的字节数组:07
and DE
(十六进制)。
我需要做的是以某种方式连接07DE
并从该十六进制值获取十进制值。在这种情况下,它是2014
.
My code:
# This line gives 11 bytes worth of information
[Byte[]] $hexbyte2 = $obj.OIDValueB
# All I need are the first two bytes (the values in this case are 07 and DE in HEX)
[Byte[]] $year = $hexbyte2[0], $hexbyte2[1]
我如何将这些组合起来07DE
并将其转换为 int 以获得2014
?
另一种选择是使用 .NET System.BitConvert 类:
C:\PS> $bytes = [byte[]](0xDE,0x07)
C:\PS> [bitconverter]::ToInt16($bytes,0)
2014
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)