Write a Java function that takes a byte array and returns a string. The string is the decoding of that byte array into ASCII. Any high-8th-bit characters are represented in hexadecimal, using strings like [0xFF] or [0x81] depending on their value. Any control characters besides space and newline are rendered using a representation that look like [EOF (0xNN)] where "EOF" stands in for the actual mnemonic of that control char and 0xNN is the hex representation. Ensure the code is high quality.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
The code is designed to be readable, maintainable, and follows Java best practices. The separate formatSpecialByte method allows for easy extension or modification of special byte handling.