Trato de aprender vb.net con ayuda de un libro y en el capítulo en el que estoy viene el siguiente código el cual no comprendo del todo y no he sabido como buscar en Google mi duda, a ver si pueden ayudarme un poco con la explicación...
Código
Module ejercicio4 Public Sub Visualizar(ByVal car As Byte) Dim i, bit As Integer For i = 7 To 0 Step -1 If ((car And (1 * (2 ^ i))) <> 0) Then bit = 1 Else bit = 0 End If System.Console.Write(bit) Next System.Console.WriteLine() End Sub 'ESTA ES LA PARTE QUE NO COMPRENDO DEL TODO... Public Function HaceAlgo(ByVal car As Byte) As Byte Return ((car And &H1) * (2 ^ 7)) Or ((car And &H2) * (2 ^ 5)) Or _ ((car And &H4) * (2 ^ 3)) Or ((car And &H8) * (2 ^ 1)) Or _ ((car And &H10) \ (2 ^ 1)) Or ((car And &H20) \ (2 ^ 3)) Or _ ((car And &H40) \ (2 ^ 5)) Or ((car And &H80) \ (2 ^ 7)) End Function Sub Main() Dim car As Byte System.Console.Write("Introduce un caracter unicode: ") car = System.Console.Read() Visualizar(car) System.Console.WriteLine("Caracter resultante: ") car = HaceAlgo(car) Visualizar(car) System.Console.ReadLine() System.Console.ReadLine() End Sub End Module
Que significa &H1, &H2... ? Que operación se realiza en ((car And &H1) * (2 ^ 7)) ? Y por que hay varios... ?
Gracias por su ayuda