Here you can find the source of hexStringToByteArray(String s)
Parameter | Description |
---|---|
s | hex string to convert |
public static byte[] hexStringToByteArray(String s)
//package com.java2s; //License from project: Open Source License import javax.xml.bind.DatatypeConverter; public class Main { /**/* w w w . j av a 2 s.co m*/ * Converts a hex string to a byte array. Found at * http://stackoverflow.com/questions/140131/convert-a-string-representation * -of-a-hex-dump-to-a-byte-array-using-java * * @param s * hex string to convert * @return byte array of converted string */ public static byte[] hexStringToByteArray(String s) { s = s.toUpperCase(); return DatatypeConverter.parseHexBinary(s); } }