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

  • Home
  • SEARCH
  • 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
  • 0 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

Hello I searched for an answer to this question but didn't find any here.
so I installed this: http://www.vimov.com/isimulate/ then i removed it because i didn't need it
I downloaded source code for a project, found a bug, and fixed it. Now
I'm using Argparser to handle arguments for my CLI prog. But as the time
I am having trouble getting my class to from program.cs to run in form.cs
What I want to do is create web pages with interactive SVG content. I
So I׳m trying to play some effects in my Cocos2D game using SimpleAudioEngine ,
I need to be able to stretch a image background to fit the window
I'm working on a desktop (swing) application with Eclipse IDE. I have three comboboxes

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.