• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

integer number too large

 
swapnil paranjape
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Experts,

I was trying a program to convert the miliseconds we get after from date object (Post Jan 1970) to date object again. Here what I was trying and I am getting interger number too large error. I am using long datatype though. Please advice.



This is the out put:
C:\jdk1.5.0_17\bin>javac MillisecondToDate.java
MillisecondToDate.java:5: integer number too large: 1222402191823
long yourmilliseconds = 1222402191823;
^
1 error

 
swapnil paranjape
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey

I got this fixed. It shud be Long yourmilliseconds = 1222402191823L;

This is what happens when you are not in touch with programing for 3 years
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15206
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This issue doesn't seem to be about the SCJP exam. I will move it to a more appropriate forum for you.
 
Campbell Ritchie
Sheriff
Posts: 48382
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should probably not be Long but long. And I see you remembered the L after the number.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic