how to convert a char from alphabetical character to hexadecimal number in java

前端 未结 3 1765
臣服心动
臣服心动 2020-12-09 08:59

how to convert a char from alphabetical character to hexadecimal number in java a if any one have any built-in method in java that does the job or if you have your own metho

3条回答
  •  鱼传尺愫
    2020-12-09 09:49

    You could use:

    Integer.toHexString((int) 'a');
    Integer.toBinaryString((int) 'b');
    

    Update: hex -> binary conversion:

    Integer.toBinaryString(Integer.parseInt("fa", 16))
    

提交回复
热议问题