Skip to content

03. HexUtil

晓寻遥 edited this page Nov 6, 2021 · 1 revision

Introduce

HexUtil is a tool class that converts a string or byte array to a hexadecimal representation.

Can be used for 「image character string representation」, 「encryption and decryption」and 「encoding conversion」.

Example

public void encodeHexStr_and_decodeHexStr(){
		String a = "this is a xiaoTools";

		// 746869732069732061207869616f546f6f6c73
		System.out.println(HexUtil.encodeHexStr(a));
		// this is a xiaoTools
		System.out.println(HexUtil.decodeHexStr(HexUtil.encodeHexStr(a)));
}

more

to learn more, refer to the API documentation

Clone this wiki locally