Here you can find the source of fromHex(String hexStr)
public static byte[] fromHex(String hexStr)
//package com.java2s; /**//from w w w . j ava 2s . c o m * Copyright (c) 2015 by SAP Labs Bulgaria, * url: http://www.sap.com * All rights reserved. * * This software is the confidential and proprietary information * of SAP AG, Walldorf. You shall not disclose such Confidential * Information and shall use it only in accordance with the terms * of the license agreement you entered into with SAP. * * Created on Mar 18, 2015 by I052264 * */ public class Main { public static byte[] fromHex(String hexStr) { int byteSize = 2; byte[] result = new byte[hexStr.length() / byteSize]; for (int i = 0; i < hexStr.length() / byteSize; i++) { String current = hexStr.substring(byteSize * i, byteSize * (i + 1)); result[i] = (byte) Integer.parseInt(current, 16); } return result; } }