Add a capital L
to the end:
long value = 9223372036854775807L;
Otherwise, the compiler will try to parse the literal as an int
, hence the error message
More Related Contents:
- Why do these two multiplication operations give different results?
- How do I convert from int to Long in Java?
- Java > Generate a lot of int
- What’s the best way to check if a String represents an integer in Java?
- In Java, is the result of the addition of two chars an int or a char?
- Convert int to char in java
- Converting Long to Date in Java returns 1970
- Why can not I add two bytes and get an int and I can add two final bytes get a byte?
- In java, is it more efficient to use byte or short instead of int and float instead of double?
- Java, Simplified check if int array contains int
- How can I check if multiplying two numbers in Java will cause an overflow?
- Java Round up Any Number
- How to implement infinity in Java?
- How to Convert Int to Unsigned Byte and Back
- How to convert a hexadecimal string to long in java?
- Return first digit of an integer
- Java: Checking if a bit is 0 or 1 in a long
- Java creating byte array whose size is represented by a long
- Java – Change int to ascii
- Why does integer division by zero 1/0 give error but floating point 1/0.0 returns “Inf”?
- negative char Value JAVA
- Convert Double to Binary representation?
- How can I convert a Java HashSet to a primitive int array?
- Unexpected result in long/int division
- Wrong result by Java Math.pow
- int[] and Integer[] arrays – What is the difference?
- Integer division in Java [duplicate]
- (a * b) / c MulDiv and dealing with overflow from intermediate multiplication
- Using int vs Integer
- Converting an int array to a String array