Here you can find the source of fromHex(String hex)
public static byte[] fromHex(String hex)
//package com.java2s; // License: https://servicestack.net/bsd-license.txt public class Main { public static byte[] fromHex(String hex) { int len = hex.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4) + Character.digit(hex.charAt(i + 1), 16)); }/*from w ww. ja v a 2s .co m*/ return data; } }