Dim GEOint As Long = ParseLong( "03E2EE47722C",16)
Sub ParseLong(Number As String, Radix As Int) As Long
Dim jo As JavaObject
jo.InitializeStatic("java.lang.Long")
Return jo.RunMethod("parseLong", Array As Object(Number, Radix))
End Sub
That value is too big to hold in an Int. You can use a Long or a Double like this
B4X:
Dim l As Long, s, sl, sr As String
s = "003E2EE47722C"
Do While s.CharAt(0) = "0"
s = s.SubString(1)
Loop
If s.Length > 6 Then
sl = s.SubString2(0, 6)
sr = s.SubString(6)
Else
sl = "0"
sr = s
End If
l = Bit.ParseInt(sl ,16) * Power(2, sr.Length*4) + Bit.ParseInt(sr ,16)
Log (sl & " " & sr)
Log(NumberFormat(l, 0, 0))
That value is too big to hold in an Int. You can use a Long or a Double like this
B4X:
Dim l As Long, s, sl, sr As String
s = "003E2EE47722C"
Do While s.CharAt(0) = "0"
s = s.SubString(1)
Loop
If s.Length > 6 Then
sl = s.SubString2(0, 6)
sr = s.SubString(6)
Else
sl = "0"
sr = s
End If
l = Bit.ParseInt(sl ,16) * Power(2, sr.Length*4) + Bit.ParseInt(sr ,16)
Log (sl & " " & sr)
Log(NumberFormat(l, 0, 0))
Dim GEOint As Long = ParseLong( "03E2EE47722C",16)
Sub ParseLong(Number As String, Radix As Int) As Long
Dim jo As JavaObject
jo.InitializeStatic("java.lang.Long")
Return jo.RunMethod("parseLong", Array As Object(Number, Radix))
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.