Search code examples
javadebuggingintellij-idea

Is it possible to view int as decimal AND hexadecimal at the same time in intellij?


When debugging in intellij, I can tell it to display a given int variable with its decimal value or its hex value.

Is it possible for the debugger to display BOTH at the same time?


Solution

  • No, it's not possible.

    When debugging, you can right click on an integer variable and choose View As > and either Hex or Primitive, not both.

    This setting only applies to the single variable and doesn't seem to persist through different debugging sessions.

    I had a look at the possibility of using a Data Type Renderer (right click a variable and go in to Customize Data Views... to see the dialog).

    A Data Type Renderer only applies to complex data types (not primitives). So if for example your int that you wanted to see 38 and 0x26 was always part of a complex object (e.g. Person.age) then perhaps a data type renderer could help.

    Alternatively you could add a String watch expression that constructs a String value for both the decimal and hex value of your int.

    Sorry that there is not a way to do exactly what you want but I hope these 2 other suggestions are useful to consider.