Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3357276
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:36:49+00:00 2026-05-18T02:36:49+00:00

i searched, i found, but it all didn’t work. my problem is that the

  • 0

i searched, i found, but it all didn’t work. my problem is that the NumberFormatException is thrown while I want to cast from String to double.

The string array atomized contains many strings and I tried to make an output before to make them visible so I could be sure there is data. the only problem is the double value. it is something like 5837848.3748980 but the valueOf method always throws the exception here. I have no idea why.

try
{
 int key = Integer.valueOf(atomized[0]);

 double value = Double.valueOf(atomized[1].trim());

 int role = Integer.valueOf(atomized[2]);

 Double newAccountState = this.bankKonto.charge(key, value, role);
 System.out.println("NEW Account State "+newAccountState);
 this.answerClient(newAccountState.toString());
}
catch (NumberFormatException e)
{
 System.out.println(e.getClass().toString()+" "+e.getMessage());
} 

Exception output:

java.lang.NumberFormatException: For input string: "109037.0"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at java.lang.Integer.valueOf(Unknown Source)
        at vsys.ue02.server.Bank.computeData(Bank.java:122)
        at vsys.ue02.server.Bank.run(Bank.java:160)
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:36:50+00:00Added an answer on May 18, 2026 at 2:36 am

    It works fine here. So I’d assume your system locale has , rather than . for decimal separator. To avoid these things you can use DecimalFormat:

    new DecimalFormat().parse("5837848.3748980");
    

    Judging by the name of your variable – account – I assume you are dealing with money. You must never use floating point types to represent money. Use BigDecimal, or possibly int

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched but i didn't found any solution to my problem. I want
Searched a lot about this problem but never found a answer, that solved it.
I searched SO and found similar questions, but none compared all three. That surprised
I searched and found three fairly good posts but all of them were animating
I have searched online but all the answers I have found were very primitive.
I have searched and found a lot of different things but none that actually
Ive searched the internet, but found nothing pertaining to my question. From the link
I searched for answers, but all i found is workaounds, not the reason, so
UPDATE : I have found the problem that my DP solution didn't handle bonus
I have searched about all the post but I can't found the solution on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.