# What mean L or D ( 12D or 100L )

What mean L or D ( 12D or 100L )?

How can convert that in decimal numbers ?
LVL 9
###### Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x

Commented:
Long is longer than an int - in Java an int is always 32 bits, and a long is 64 bits. Double is a floating point type, and again you can have a 32 bit float or a 64 bit double.
0

Commented:
L, long
D, double

0

Author Commented:
Whay I need a double value to assign 12 for exmple ? An Integer is ok I think .

I see in some codes 12D or 10D or 0.978D
And 856558L .
0

Commented:
They only reason you might need 12D is in an expression that has other doubles. It really depends on the math you are doing. If the math can be done with just integers, that is great (integer math is usually faster than floating point). But if you have to go to floating point, it then depends on the application. If you're just doing money, use floats. If you're doing something that requires a lot of decimal precision, you might have to go to doubles. Sometimes you'll also have to use double because that is how someone else's method is written.

As far as long vs. int, there the difference is in how large a number you can represent. A 32 bit int can represent numbers from -2,147,483,648 to 2,147,483,647. A 64 bit long can have a max value of 9,223,372,036,854,775,807 (that is a big number!)

So it just depends on what kind of thing you are doing. If you are just keeping track of something that goes up to 100, it is just a waste of space to use a long. You might think it is also wasteful to use an int for that, but you also have to think about the default size on the platform(s) you are targeting.
0