Solved

long Numeric Overflow

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
V.simple question about Android packages and libraries 1 20
recursion example 16 126
object oriented programming comparison 5 71
tomcat not starting 6 45
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…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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 practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

770 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