Android Question Convert through bases

fabero

Member
Licensed User
For example I have a hexadecimal number (so is a String value), how I can convert it?

So how to convert FF to 255 ?

My goal is to convert numbers can be at maximum and Int64 value.

Thanks in advance.
 

fabero

Member
Licensed User
I see that but I don't understand the solution.

For Example if I passing F000000 is my hexadecimal number to convert I obtain

java.lang.NumberFormatException: For input string: "F0000000"

if the number is FF no problem, it was converted to 255
 
Upvote 0

fixit30

Active Member
Licensed User
Can you post your code?

The below gives me a result of 251658240

B4X:
            Dim i As Int
    i = Bit.parseint("F000000", 16)
 
Upvote 0

fabero

Member
Licensed User
I Guess...This is my mistake...
In my case the i value is a string value of a textfield text value.
So I need to "convert" the string in an Int number... How to that?
 
Upvote 0

fabero

Member
Licensed User
It won't works. If the text field has 3412CDAB it works, if it has FFFFFFFF I gave
java.lang.NumberFormatException: For input string: "FFFFFFFF"

I suppose because the value is over the Int maximum positive value.
 
Upvote 0

fabero

Member
Licensed User
I'm very disappointed. For my habits I post here in B4A forum, but I'm using the B4J project now.

Sorry for the incovenience..
 
Upvote 0
Top