Long in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Long in java

If we have a number that makes just from 9(for example 9999)what is the maximum number in long?

15th Jul 2020, 12:53 PM
Zahra
6 Answers
+ 6
That's not how limits of data types exist. As you might know that everything is stored as group of binary digits in computer's memory. So larges number that can be stored would be the largest number than can be formed using the available memory space to that data type. For *long* data type:- it takes 64 bits to represent the number so the largest number that can be represented using all the 63 bits(as one is reserved for -/+ sign) available is 2^63 = 9,223,372,036,854,775,807
15th Jul 2020, 1:04 PM
Arsenic
Arsenic - avatar
+ 2
The range of the long data value is: -2^63 to 2^63 - 1. Therefore the maximum (approx) is, 9.2233E18. The number of digits allowed in the long data type made fully of 9's should be 17 digits long
15th Jul 2020, 1:01 PM
Partha Jagdale
Partha Jagdale - avatar
+ 1
Can you say how you calculate that?
15th Jul 2020, 1:03 PM
Zahra
0
I know that but I want to know what's the maximum number full of nines It is 18 digit or 17 digit?
16th Jul 2020, 7:14 AM
Zahra
0
Byte :8bits Short:16bits Int:32bits Long:64bits.
16th Jul 2020, 6:27 PM
shubham kumar
shubham kumar - avatar
0
Rithea Sreng the answer is 9223372036854775807
16th Jul 2020, 7:32 PM
This is junk email
This is junk email - avatar