Prototype: copyBuffer(byte[] input) -> byte[] returns an independent array with identical bytes, including empty input.
Final: implement nested ByteCache(long byteBudget), requiring budget>=0, with get/put/remove/usage/clear. Keys are nonnull nonempty strings, values nonnull byte arrays; invalid key raises IllegalArgumentException before mutation. put(key,value) returns false unchanged when value.length>budget. Otherwise clone value, replace existing entry, refresh recency, and evict least-recent entries until payload usage<=budget; return true. Zero-length arrays are valid even at budget zero. get(key) returns null on miss, otherwise a new buffer copy and refreshes recency. remove(key) returns whether present and releases bytes once. usage() sums retained payload lengths; clear empties all entries and sets usage zero. Each instance owns its entries; payload budget excludes object overhead.
Complete the starter code, then run the checks.
Results and errors will appear here.
Java runs on this device with CheerpJ 4.3.