The first bit is the sign bit, that is, the first hex number is 8-F, the value is a negative, the number = number - 2^32.
it should be 4038068830-4294967296=-256898466
The first bit is the sign bit, that is, the first hex number is 8-F, the value is a negative, the number = number - 2^32.
it should be 4038068830-4294967296=-256898466
Dim myLon As String
myLon = raw.SubString2(66,74)
Dim bc As ByteConverter
Dim b() As Byte=bc.HexToBytes(myLon)
Dim Longitude() As Int=bc.IntsFromBytes(b)
Log(Longitude(0))
I get the following error on compile:
B4X:
B4J Version: 9.80
Parsing code. (0.01s)
Java Version: 14
Building folders structure. (0.02s)
Compiling code. Error
Error compiling program.
Error description: Current declaration does not match previous one.
Previous: {Type=Int,Rank=0, RemoteObject=True}
Current: {Type=Int,Rank=1, RemoteObject=True}
Error occurred on line: 212
Dim Longitude() As Int=bc.IntsFromBytes(b)
Dim raw As String = "0123456789012345678901234567890123456789012345678901234567890.....F0B00A5E....." 'test sample
Dim myLon As String
myLon = raw.SubString2(66, 74)
Log(myLon)
'Dim bc As ByteConverter
'Dim b() As Byte=bc.HexToBytes(myLon)
'Dim Longitude() As Int=bc.IntsFromBytes(b)
'Log(Longitude(0))
Dim Longitude As Int = Bit.ParseLong(myLon, 16) 'there should be a law against this but, hey, if it works, it works
Log(Longitude)
Log output:
Waiting for debugger to connect...
Program started.
F0B00A5E
-256898466
Dim myLon As String
myLon = raw.SubString2(66,74)
Dim bc As ByteConverter
Dim b() As Byte=bc.HexToBytes(myLon)
Dim Longitude() As Int=bc.IntsFromBytes(b)
Log(Longitude(0))
I get the following error on compile:
B4X:
B4J Version: 9.80
Parsing code. (0.01s)
Java Version: 14
Building folders structure. (0.02s)
Compiling code. Error
Error compiling program.
Error description: Current declaration does not match previous one.
Previous: {Type=Int,Rank=0, RemoteObject=True}
Current: {Type=Int,Rank=1, RemoteObject=True}
Error occurred on line: 212
Dim Longitude() As Int=bc.IntsFromBytes(b)
Dim myLat As String
Dim myLon As String
myLat = raw.SubString2(58,66)
myLon = raw.SubString2(66,74)
Dim b() As Byte=bc.HexToBytes(myLat)
Dim Latitude() As Int=bc.IntsFromBytes(b)
Log(Latitude(0))
Dim b() As Byte=bc.HexToBytes(myLon)
Dim Longitude() As Int=bc.IntsFromBytes(b)
Log(Longitude(0))
Log("Latitude: " & Latitude(0))
Log("Longitude: " & Longitude(0))