Sub ToBinaryString(a) As String
Dim i As Int
'Convert the passed variable (a) to Decimal
i = Bit.ParseInt(a, 16)
'build the String bit by bit
Dim sb As StringBuilder
sb.Initialize
Dim x As Int = Bit.ShiftLeft(1, 7)
For j = 0 To 7
Dim ii As Int = Bit.And(i, x)
If ii <> 0 Then
sb.Append("1")
Else
sb.Append("0")
End If
x = Bit.UnsignedShiftRight(x, 1)
Next
Return sb.ToString
End Sub