Solved

long Numeric Overflow

Posted on 1998-05-25
3
259 Views
Last Modified: 2011-09-20
I need to convert a large amount of seconds to milliseconds but when I try to compile my program with ...

long lDiff = 2207520000 * 1000;

I get a Numeric Overflow error.

I am using the same line of code for a larger number and have no problem (the number is growing but is around 3,700,000,000 now.

Any Ideas on how I can get this to work? or what I am doing wrong?
0
Comment
Question by:jkb2
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
imladris earned 100 total points
ID: 1221445
I can't exactly reproduce it on my system. However, I'm pretty sure that your compiler thinks that one or other or the result is an integer. If you append a capital L (to indicate it is a long constant), all should be well.

0
 
LVL 1

Author Comment

by:jkb2
ID: 1221446
That's it...Thanks

For a newbie I would have to say the JDK is a little picky ;)

0
 
LVL 1

Author Comment

by:jkb2
ID: 1221447
That's it...Thanks

For a newbie I would have to say the JDK is a little picky ;)

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jar file executable 12 58
Should localization be done inside spring controller 5 32
JavaFX TableView not displaying correctly 3 58
Eclipse for Java EE development 2 28
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question