Solved

long Numeric Overflow

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

617 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