最近做项目时,为了将byte[]存入map的value,先将其转为String存入,需要时再取出转回byte[],但实现过程却发现了问题:转回的byte[]与原来不一致:
byte[] bytes = Hex.decode("1a91031001");
String str = new String(bytes);
byte[] after = str.getBytes();
System.out.println("before: " + Hex
最近做项目时,为了将byte[]存入map的value,先将其转为String存入,需要时再取出转回byte[],但实现过程却发现了问题:转回的byte[]与原来不一致:
byte[] bytes = Hex.decode("1a91031001");
String str = new String(bytes);
byte[] after = str.getBytes();
System.out.println("before: " + Hex