java中十六进制编码与解码
文章目录
一、简介
十六进制编码就是把二进制转换十六进制字符串,即是0-9,a-f。或者相反。实现就是将二进制流,每四位一组,进行编码。
二、代码实现
public class ByteHexMain {
public static void main(String[] args) throws Exception {
String source = "study hard and make progress everyday";
System.out.println("source : "+source);
String hexStr = bytes2HexStr(source.getBytes("utf8")); //编码
System.out.println("encode result : "