Search code examples
androidbinaryloggingnotation

Sys.Log numbers in binary notation in android?


Is it possible to log numbers in binary notation?

For example Logbinary(0x3) should give my 0111 when using signed notation.


Solution

  • Use

    Integer.toBinaryString(yourint);
    

    or

    Long.toBinaryString(yourint);
    

    to convert your number to a binary string which you can log.