private static String str2Hex(String theStr) {
                byte[] bytes;
                String result = "";
                int tmp;
                String tmpStr;
                try {
                        bytes = theStr.getBytes("GBK");
                        for (int i = 0; i < bytes.length; i++) {
                                if (bytes[i] < 0) {
                                        tmp = 256 + bytes[i];
                                        tmpStr = Integer.toHexString(tmp).toUpperCase();
                                        result += tmpStr;
                                } else {
                                        tmpStr = Integer.toHexString(bytes[i]).toUpperCase();

                                        result += tmpStr.length() == 1 ? "0" + tmpStr : tmpStr;
                                }
                        }
                } catch (UnsupportedEncodingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                return result;
        }