Results 1 to 2 of 2
  1. #1
    bbq
    bbq is offline Senior Member
    Join Date
    Jun 2007
    Posts
    132
    Rep Power
    0

    Default Error: convert from String to long

    I want to convert from string to long type

    I do that:
    Java Code:
    long tmp = Long.valueOf("12.23");
    When I run it this error appears:
    Java Code:
    java.lang.NumberFormatException: For input string: "12.34"
    How can I solve this?

    thanks,

  2. #2
    alex mair is offline Member
    Join Date
    Jun 2007
    Posts
    2
    Rep Power
    0

    Default

    12.23 is of type float or double.

    Try

    double tmp = Double.parseDouble("12.34");

Similar Threads

  1. How to convert a string into a BigInteger
    By valery in forum New To Java
    Replies: 4
    Last Post: 09-13-2011, 01:32 PM
  2. how to convert String number to int
    By gabriel in forum New To Java
    Replies: 5
    Last Post: 08-02-2009, 03:46 PM
  3. Cannot convert from char to String error
    By sondratheloser in forum New To Java
    Replies: 1
    Last Post: 12-13-2007, 09:28 PM
  4. convert string to float
    By miss_dot in forum NetBeans
    Replies: 1
    Last Post: 11-14-2007, 11:26 PM
  5. Replies: 1
    Last Post: 08-07-2007, 07:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •