Here you can find the source of stringToHex(String ids)
public static byte[] stringToHex(String ids)
//package com.java2s; public class Main { public static byte[] stringToHex(String ids) { byte[] buf = new byte[ids.length() / 2]; for (int i = 0, j = 0; i < buf.length; i++, j += 2) { byte h = (byte) ((byte) ids.charAt(j) - 0x30); byte l = (byte) ((byte) ids.charAt(j + 1) - 0x30); buf[i] = (byte) (h << 4 | l); }/*from w ww .j a v a 2s .co m*/ return buf; } }