If someone can point out a specific term to what I'm trying to do, I will still listen to it. However, I found a way to do what I needed, and I will post it here so that if someone looks after me, they can find it. There may be (maybe there is) a simpler, more direct way to do this, but here is what I did in VB.Net to return the bytecode I wanted:
Private Function Encode(ByVal original As Integer) as Byte()
Dim twofiftysixes As Integer = CInt(Math.Floor(original / 256))
Dim sixteens As Integer = CInt(Math.Floor((original - (256 * twofiftysixes)) / 16))
Dim ones As Integer = original Mod 16
Dim bytecode As Byte() = {CByte((16 * sixteens) + ones), CByte(twofiftysixes), 0, 0}
Return bytecode
End Function
Effectively decompose an integer into its hexadecimal components, and then convert the corresponding pairs to cBytes.
source
share