Hex Dumps in Eclipse Detail Formatters

If you’ve got an object that can be represented as a byte[] array, and you want to view the bytes as a hex dump in Eclipse you can use a snippet like the following in a custom Detail Formatter to do so (in this example introspecting a ByteBuffer):

new sun.misc.HexDumpEncoder().encode(this.array())