fork(1) download
  1. Imports System
  2. Imports System.Collections
  3.  
  4. Public Class Test
  5. Public Shared Sub Main()
  6. Dim Input As String = "000000000100000100000000010000100000000001000011"
  7. Dim Bits As New BitArray(Input.Length)
  8.  
  9. For x As Integer = 0 To Input.Length - 1
  10. Bits(x) = Convert.ToBoolean(Integer.Parse(Input.Chars(x)))
  11. Next
  12.  
  13. Dim Result As String = BitArrayToString(Bits)
  14. Console.WriteLine(Result)
  15. End Sub
  16.  
  17. Public Shared Function BitArrayToString(ByVal Bits As BitArray) As String
  18. Dim ReversedValues As Boolean() = New Boolean(Bits.Count - 1) {}
  19. For x As Integer = 0 To Bits.Count - 1
  20. ReversedValues((ReversedValues.Length - 1) - x) = Bits(x)
  21. Next
  22.  
  23. Dim ReversedBits As New BitArray(ReversedValues)
  24. Dim Bytes As Byte() = New Byte(Math.Ceiling(ReversedBits.Length / 8) - 1) {}
  25. ReversedBits.CopyTo(Bytes, 0)
  26.  
  27. Dim Result As String = System.Text.Encoding.Unicode.GetString(Bytes)
  28. Dim Chars As Char() = Result.ToCharArray()
  29. Array.Reverse(Chars)
  30.  
  31. Return New String(Chars)
  32. End Function
  33. End Class
Success #stdin #stdout 0.02s 24272KB
stdin
Standard input is empty
stdout
ABC