Converting a set of strings to a byte[] array

前端 未结 6 1064
甜味超标
甜味超标 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:43

    hexToInt should be like this

    private static int hexToInt(char c1, char c2) {
        return (Character.digit(c1, 16) << 4) + Character.digit(c2, 16);
    }
    

    Otherwise CA returns AA in byte.

提交回复
热议问题