Results for “integer”
Small, practical examples. Search by task or narrow things down below.
Decode a 16-bit big-endian integer
C: Promote bytes to an unsigned integer type before combining shifted values.
C✓ Tested
Define related integer constants
Define related integer constants using a complete Go program with explicit sample inputs.
Go✓ Tested
Detect integer addition overflow
Java: Math.addExact throws rather than silently wrapping on overflow.
Java✓ Tested
Detect integer overflow with checked
C#: A checked arithmetic block throws instead of silently wrapping an integer result.
C#✓ Tested
Display an integer as unsigned
Java: Use unsigned conversion methods when interpreting a fixed-width bit pattern.
Java✓ Tested
Divide negative integers with floor rounding
Java: floorDiv and floorMod provide consistent floor-based quotient and remainder.
Java✓ Tested
Encode an integer as big-endian bytes
Encode an integer as big-endian bytes in a complete Rust program using the standard library.
Rust✓ Tested
Extract all integer tokens from text
C#: Enumerate Match objects returned by Regex.Matches with an explicit timeout.
C#✓ Tested
Format a nonnegative integer amount as whole and fractional units
C: Keep the calculation in integer minor units and use two digits for the remainder.
C✓ Tested
Format an integer as padded hexadecimal
Format an integer as padded hexadecimal in a complete Rust program using the standard library.
Rust✓ Tested
Format an integer into a caller-owned buffer
C++: to_chars avoids allocation and reports whether the buffer was large enough.
C++✓ Tested
Format several integers in a fixed buffer
Arduino / C: snprintf limits writes to the buffer size and includes a terminating null byte.
Arduino / C✓ Tested