Android Question Convert through bases

Discussion in 'Android Questions' started by fabero, May 24, 2015.

  1. fabero

    fabero Active 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.
     
  2. fixit30

    fixit30 Active Member Licensed User

  3. fabero

    fabero Active 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
     
  4. fixit30

    fixit30 Active Member Licensed User

    Can you post your code?

    The below gives me a result of 251658240

    Code:
    Dim i As Int
        i = 
    Bit.parseint("F000000"16)
     
  5. fabero

    fabero Active 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?
     
  6. fixit30

    fixit30 Active Member Licensed User

    Code:
    Dim i As Int
        i = 
    Bit.parseint(textfield.text, 16)
     
  7. fabero

    fabero Active 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.
     
  8. fabero

    fabero Active 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..
     
Loading...
  1. 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.
    Dismiss Notice