Solved

long Numeric Overflow

Posted on 1998-05-25
3
251 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now