Problem: I want to view a byte array in the Eclipse (Helios Release, build id: 20100617-1415) Java debugger as an array of hex bytes (2 digits each) or unsigned decimal numbers? Is that possible? How? For example, I want to display this: ...as: 0, 48, 71, 22, 139, 166, ... ...or as: 0x00, 0x30, 0x47, 0x16, 0x8B, 0xA6, ... Solution: 1. Switch to Debug perspective. In the Variables view click the "menu" item (triangle item before minimize) and select "Java Primitives...". In the Dialog you can choose between Hex view, Ascii view and unsigned (for byte). 2. You can do this from Window->Preferences. For primitives, browse to Java->Debug->Primitive Display Options Here there is a checkbox for 'Display Hexadecimal values'. Check this, and you will see both decimal & hexadecimal representations for primitives in the 'value' column under Variables view when debugging. For objects (Integer, Long, etc), browse to Java->Debug->Detail Formatters For each type you care about, create a detail formatter that formats the value how you like. For java.lang.Integer, you could use the detail formatter: Integer.toHexString(this) Make sure your detail formatter is enabled, and you should see the hexadecimal representation in the 'details' area when you select a variable from the Variables view. |
|
来自: Harrison.Ding > 《Eclipse》