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 ex开发者_如何学编程ample, I want to display this:
...as: 0, 48, 71, 22, 139, 166, ...
...or as: 0x00, 0x30, 0x47, 0x16, 0x8B, 0xA6, ...
(This is a similar question to "How do I display a byte array as a char array in the Eclipse Java debugger?".)
Not exact what you want but as I know in DEBUG MODE, there is an option for primitive Types (int, long,...).
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).
Found this, maybe help: Inside the Memory View
On 3.7 (and maybe earlier), go into preferences, type "primitive display" in the filtering area, and choose to display hex values.
Updated answer in Eclipse Kepler 4.3:
In the Debug
perspective, the Variables
tab will have:
View Menu
(a downward triangle),Minimize
(a line), andMaximize
(a window) icons in the upper-right corner.
Steps:
- Click on
View Menu
>Java
>Java Preferences...
to bring up a menu. - In this menu select
Java
>Debug
>Primitive Display Options
. - Check
Display hexadecimal values
and then clickOK
. - You should now see hex values in brackets in the
Variables
tab.
In IntelliJ IDEA 14, displaying of hex values in arrays in debugger can be enabled with Settings → Debugger → Data Views → Java → Show hex values for primitives.
You can add a Watch Expression:
StringBuilder sb = new StringBuilder();
for(byte b: buf) {
sb.append(String.format("%02x, ", b & 0xff));
}
sb.setLength(sb.length() - 2);
return "[" + sb + "]";
For eclipse neon IDE
Displaying values in hexadecimal format
goto Windows -> Preferences -> Java -> Debug -> Primitive Display option -> Display Hexadecimal values(byte,short,char,int,long)
enable the option and press OK
NOTE: This works in debug mode
精彩评论