Java tutorial
//package com.java2s; //License from project: Open Source License import android.util.Log; public class Main { static final String TAG = "jamorham cip"; public static byte[] hexToBytes(String hex) { try { int length = hex.length(); byte[] bytes = new byte[length / 2]; for (int i = 0; i < length; i += 2) { bytes[i / 2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4) + Character.digit(hex.charAt(i + 1), 16)); } return bytes; } catch (Exception e) { Log.e(TAG, "Got Exception: " + e.toString()); return new byte[0]; } } }