I am using Java SE Development kit 8 update 25(64 bit). I have read the "Primitive Data Types" java tutorial from The Java™ Tutorials and according to this specification the long type can hold the maximum value of (2 to the power 64)-1 which is 18446744073709551615.
But the below code throws "integer number too large" error message.
public class SampleClass
{
public static void main (String[] args)
{
Long longMaxValue= 18446744073709551615L /* UInt64.MaxValue */;
}
}
Also the Long.Max_Value only returns 9223372036854775807 . Why? I need to store the value 18,446,744,073,709,551,615 as a constant in java. What should I do?
Any help will be appriciated.