Here you can find the source of fromHex(String hexData)
public static byte[] fromHex(String hexData)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] fromHex(String hexData) { byte[] result = new byte[(hexData.length() + 1) / 2]; String hexNumber = null;/*from w ww. j a va 2s. co m*/ int stringOffset = 0; int byteOffset = 0; while (stringOffset < hexData.length()) { hexNumber = hexData.substring(stringOffset, stringOffset + 2); stringOffset += 2; result[(byteOffset++)] = ((byte) Integer.parseInt(hexNumber, 16)); } return result; } }