Converting a set of strings to a byte[] array

前端 未结 6 1020
甜味超标
甜味超标 2021-01-23 04:45

I am tring to convert a set of strings to a byte[] array. At first, I do something like this to convert a byte array to a string:

public String convertByte(byte[         


        
6条回答
  •  一向
    一向 (楼主)
    2021-01-23 05:30

    If you are sure that the string contains 1 byte, you can do:

    byteArray[i] = st[i].getbytes()[0];
    

提交回复
热议问题