Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function IntegerToBooleanArray(ByVal Value As Integer) As Boolean()
- If Value = 0 Then Return {False}
- Dim bools() As Boolean = {}, pow As Integer = 0, index As Integer = 1
- While True
- If 2 ^ pow > Value Then
- pow -= 1
- ReDim bools(pow)
- bools(0) = True
- Value -= 2 ^ pow
- pow -= 1
- For i = pow To 0 Step -1
- If 2 ^ pow > Value Then
- bools(index) = False
- Else
- bools(index) = True
- Value -= 2 ^ pow
- End If
- index += 1
- pow -= 1
- Next
- Return bools
- Else
- pow += 1
- End If
- End While
- Return {}
- End Function
Advertisement
Add Comment
Please, Sign In to add comment