long
In short: An integer data type with a larger value range than the standard integer (usually 64 instead of 32 bits) — needed when values can exceed the normal integer range.
In more detail: Typical use cases are timestamps (milliseconds since a fixed reference point), very large counters, or unique IDs that grow beyond the normal 32-bit range over time. In many languages, a long literal has to be explicitly marked (e.g. with an appended L), otherwise the compiler interprets the number as a smaller integer type by default.
In Depth
The reason for the fixed size: an integer type with n bits can represent exactly 2^n different values. A 32-bit integer therefore covers roughly −2.1 to +2.1 billion — enough for the vast majority of everyday numbers, but too little, for example, for a timestamp in milliseconds (which exceeds this range after just a few decades) or for very large database IDs.
int normal = 2147483647; // maximum for a 32-bit int
long large = 9223372036854775807L; // maximum for a 64-bit longIf a calculation with normal integers is performed whose result exceeds the value range, an integer overflow occurs: the value “overflows” and jumps (depending on the language) back to the most negative possible value, instead of throwing an error — a classic, hard-to-find bug, because the program simply continues with a suddenly wrong (often negative) number, with no obvious crash. long shifts this limit far enough up that it’s no longer relevant in practice for almost all realistic numbers.
The downside of a long compared to a normal integer is double the memory usage per value (8 instead of 4 bytes) — negligible for individual variables, but can genuinely add up for millions of stored values (e.g. in a large array or a database table). Rule of thumb: only use long where the value range of a normal integer could genuinely become too tight, not preemptively everywhere.