How to convert Java String into byte[]?

后端 未结 8 1553
不知归路
不知归路 2020-11-22 16:00

Is there any way to convert Java String to a byte[] (not the boxed Byte[])?

In trying this:

System.ou         


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 16:16

    Simply:

    String abc="abcdefghight";
    
    byte[] b = abc.getBytes();
    

提交回复
热议问题