Imports System.Numerics
Module Example
Dim bytes() As Byte
Public Sub Main()
Dim numbers() As BigInteger = { Int64.MaxValue, BigInteger.Parse("9999") }
For Each number As BigInteger In numbers
bytes = number.ToByteArray()
Console.Write("{0} ({1}) -> ", number, number.ToString(GetSpecifier()))
Console.Write("{0} bytes: ", bytes.Length)
For Each byteValue As Byte In bytes
Console.Write("{0:X2} ", byteValue)
Next
Console.WriteLine()
Next
End Sub
Private Function GetSpecifier() As String
Return "X" + CStr(bytes.Length * 2)
End Function
End Module