Long literal
A Long literal is a numeric literal whose syntax specifies that its value has the Kotlin Long integer type.
100 Java Mistakes and How to Avoid Them
- How it is used
- Prevents `int` arithmetic, shifts, and hexadecimal masks from producing incorrect values when long-width results are intended.
- How deep it goes
- Explains expression typing, shift behavior, signed widening, overflow consequences, tests, API alternatives, and selected static-analysis checks.
- Examples
- Uses microsecond conversion, a long bit-setting method, and a hexadecimal mask that accidentally widens from `int` to `long`.
- What you can do after
- Diagnose/debug with it by identifying `int` operands in long computations and correcting literals, casts, tests, or API usage.
Read how 100 Java Mistakes and How to Avoid Them explains Long literal →
Learn C++ by Example
A literal suffix is a token appended to a literal to determine or customize the type or interpretation of its value.
- How it is used
- Makes chrono durations and calendar dates readable in countdown and date-handling code.
- How deep it goes
- Explains suffix syntax, supported units, namespaces, and operator implementation without developing custom literal definitions.
- Examples
- Uses duration forms such as 23h and date forms such as 2022y / December / 31.
- What you can do after
- Apply it via chrono literal suffixes to write strongly typed durations and readable calendar dates.
Related concepts
- numerical overflowaddresses · Numerical overflow is the condition in which an arithmetic result falls outside the range representable by its numeric type or format.
- bit shiftingconfigures · Bit shifting is a bitwise operation that moves the positions of an integer’s binary digits left or right by a specified count.
- dateconfigures · A date is a calendar value identifying a particular day.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

