差異處
這裏顯示兩個版本的差異處。
java:basic:converter [2016/11/22 11:19] tony 移除 |
java:basic:converter [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>java}} | ||
- | ====== Converter ====== | ||
- | ===== Hex String to byte array ===== | ||
- | <code java> | ||
- | private byte[] toBytes(String hexStr){ | ||
- | hexStr = hexStr.replaceAll("0[x|X]", ""); | ||
- | return new BigInteger(hexStr, 16).toByteArray(); | ||
- | } | ||
- | </code> | ||
- | |||
- | |||