Powershell Byte array to INT -
i have byte array 2 values: 07
, de
(in hex).
what need somehow concatenate 07de
, decimal value hex value. in case, 2014
.
my code:
# line gives 11 bytes worth of information [byte[]] $hexbyte2 = $obj.oidvalueb # need first 2 bytes (the values in case 07 , de in hex) [byte[]] $year = $hexbyte2[0], $hexbyte2[1]
how combined these make 07de
, convert int 2014
?
another option use .net system.bitconvert class:
c:\ps> $bytes = [byte[]](0xde,0x07) c:\ps> [bitconverter]::toint16($bytes,0) 2014
Comments
Post a Comment