Solved

long Numeric Overflow

Posted on 1998-05-25
3
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

749 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