How to cast String to byte array?

前端 未结 3 1624
别跟我提以往
别跟我提以往 2021-01-29 09:03

I have a String, which contains the byte array\'s String value. How could I convert this String to byte array? How I tried:

String stringValue=\"33321232\"; //th         


        
3条回答
  •  滥情空心
    2021-01-29 09:38

    try calling getBytes() like this way

    String stringValue="33321232"; //the bytes in String
    bytes[] b=stringValue.getBytes();
    

    For more info check oracle docs

提交回复
热议问题