Board index » jbuilder » JB2005 and long integers

JB2005 and long integers


2005-04-23 04:39:17 AM
jbuilder17
I am trying to store the following value in a constant: 47,304,200,000 as
follows:
public static final long MY_CONSTANT = 47304200000;
Jbuilder gave me the following errorinsight error: integer number too large.
So I had to store the number this way:
public static final long MY_CONSTANT = (long)47304200 * 1000;
Why does JBuilder not like long integers that I type in?
Thanks in advance for any insight!
-Eric
 
 

Re:JB2005 and long integers

I would write
47304200L * 1000
- Alexey.
Eric wrote:
Quote
I am trying to store the following value in a constant: 47,304,200,000 as
follows:

public static final long MY_CONSTANT = 47304200000;

Jbuilder gave me the following errorinsight error: integer number too large.

So I had to store the number this way:

public static final long MY_CONSTANT = (long)47304200 * 1000;


Why does JBuilder not like long integers that I type in?

Thanks in advance for any insight!

-Eric



 

Re:JB2005 and long integers

Alexey N. Solofnenko wrote:
Quote
I would write

47304200L * 1000

- Alexey.

Eric wrote:

>I am trying to store the following value in a constant: 47,304,200,000
>as follows:
>
>public static final long MY_CONSTANT = 47304200000;
>
public static final long MY_CONSTANT = 47304200000L;
You gotta tell the compiler you have a long, by tagging it with that 'L'
at the end.
--
Regards,
Lori Olson [TeamB]
 

{smallsort}

Re:JB2005 and long integers

cool!
I never new about the number suffixes.
so this works:
public static final long MY_CONSTANT = 47304200000L;
What other suffixes are available, and is there documentation on this? Is
this suffix specific to JB only? or is this a standard convention?
Thanks again!
-Eric
"Alexey N. Solofnenko" < XXXX@XXXXX.COM >wrote in message
Quote
I would write

47304200L * 1000

- Alexey.

Eric wrote:
>I am trying to store the following value in a constant: 47,304,200,000 as
>follows:
>
>public static final long MY_CONSTANT = 47304200000;
>
>Jbuilder gave me the following errorinsight error: integer number too
>large.
>
>So I had to store the number this way:
>
>public static final long MY_CONSTANT = (long)47304200 * 1000;
>
>
>Why does JBuilder not like long integers that I type in?
>
>Thanks in advance for any insight!
>
>-Eric
>
>
 

Re:JB2005 and long integers

The other is F or f for float and D or d for doubles, but for floating
point literals double is the default, so you don't need to specify 2.1d for
example.
java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html
Arth
"Eric" < XXXX@XXXXX.COM >wrote in message
Quote
cool!
I never new about the number suffixes.

so this works:
public static final long MY_CONSTANT = 47304200000L;

What other suffixes are available, and is there documentation on this? Is
this suffix specific to JB only? or is this a standard convention?

Thanks again!

-Eric

 

Re:JB2005 and long integers

On 4/22/2005 at 5:12:37 PM, Eric wrote:
Quote
What other suffixes are available, and is there documentation on this?
See the Java Language Specification:
java.sun.com/docs/books/jls/second_edition/html/jTOC.doc.html
Quote
Is this suffix specific to JB only? or is this a standard convention?
It is standard Java. JBuilder does not extend the Java language in any
way, and I believe it would violate their license to do so. The more
recent versions of JBuilder actually use the Sun Java compiler.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html