Converting A String To Hexadecimal In Java

前端 未结 21 2519
青春惊慌失措
青春惊慌失措 2020-11-22 09:55

I am trying to convert a string like \"testing123\" into hexadecimal form in java. I am currently using BlueJ.

And to convert it back, is it the same thing except b

21条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 10:32

    To get the Integer value of hex

            //hex like: 0xfff7931e to int
            int hexInt = Long.decode(hexString).intValue();
    

提交回复
热议问题