Here you can find the source of fromHex(String str)
public static byte[] fromHex(String str)
//package com.java2s; //License from project: Open Source License import javax.xml.bind.DatatypeConverter; public class Main { public static byte[] fromHex(String str) { return DatatypeConverter.parseHexBinary(new String(reverseHEX(str.getBytes()))); }//w ww . j av a 2s. c o m public static byte[] reverseHEX(byte[] b) { byte temp; for (int i = 1; i < b.length; i = i + 2) { temp = b[i]; b[i] = b[i - 1]; b[i - 1] = temp; } return b; } }