Here you can find the source of parseHexStr2Byte(String hexStr)
public static byte[] parseHexStr2Byte(String hexStr)
//package com.java2s; public class Main { public static byte[] parseHexStr2Byte(String hexStr) { if (hexStr.length() < 1) return null; byte[] result = new byte[hexStr.length() / 2]; for (int i = 0; i < hexStr.length() / 2; i++) { int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);//from w w w . ja v a 2 s.c om int low = Integer.parseInt( hexStr.substring(i * 2 + 1, i * 2 + 2), 16); result[i] = (byte) (high * 16 + low); } return result; } }