Results for “binary”
Small, practical examples. Search by task or narrow things down below.
Encode a value as little-endian bytes
Arduino / C: Store the least significant byte first when the protocol requires it.
Arduino / C✓ Tested
Enumerate the items of a JSON array
C#: Dispose JsonDocument after reading its elements.
C#✓ Tested
Extract the low and high byte of a value
Arduino / C: lowByte and highByte expose the two bytes of a 16-bit value.
Arduino / C✓ Tested
Format a known timestamp in UTC
C: gmtime converts to UTC calendar fields and strftime formats them.
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
Handle malformed JSON
C#: Catch JsonException for malformed JSON without swallowing unrelated failures.
C#✓ Tested
Hash a UTF-8 value with SHA-256
C#: Use SHA256.HashData for a one-shot content digest.
C#✓ Tested
Load a small properties configuration
Java: Use a Reader to make the configuration character encoding explicit.
Java✓ Tested
Locate a value in a sorted array
Java: Use Arrays.binarySearch only after establishing ascending order.
Java✓ Tested
Measure the byte length of UTF-8 text
C#: Character count and encoded byte count can differ for non-ASCII text.
C#✓ Tested
Move a file to a new name
Java: Files.move changes the path and returns the destination Path.
Java✓ Tested
Normalize relative path components
Java: Path.normalize removes redundant dot components without accessing the filesystem.
Java✓ Tested