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

    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?


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


    12.23 is of type float or double.


    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, 02:32 PM
  2. how to convert String number to int
    By gabriel in forum New To Java
    Replies: 5
    Last Post: 08-02-2009, 04:46 PM
  3. Cannot convert from char to String error
    By sondratheloser in forum New To Java
    Replies: 1
    Last Post: 12-13-2007, 10:28 PM
  4. convert string to float
    By miss_dot in forum NetBeans
    Replies: 1
    Last Post: 11-15-2007, 12:26 AM
  5. Replies: 1
    Last Post: 08-07-2007, 08: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