How to efficiently convert byte array to string

前端 未结 5 1388
情深已故
情深已故 2020-12-17 18:59

I have a byte array of 151 bytes which is typically a record, The record needs to inserted in to a oracle database. In 151 byte of array range from 0 to 1 is a record id , 2

5条回答
  •  自闭症患者
    2020-12-17 19:43

    None of the answers here consider that you might not be using ASCII. When converting bytes to a string, you should always consider the charset.

    new String(bytes, offset, length, charset);
    

提交回复
热议问题