Here you can find the source of hexStrToStr(String hexStr)
public static String hexStrToStr(String hexStr)
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; public class Main { public static String hexStrToStr(String hexStr) { String decStr = ""; ByteBuffer bytes = ByteBuffer.allocate(hexStr.length() / 2); for (int i = 0; i < hexStr.length(); i += 2) { Byte b = (byte) (0xff & Integer.parseInt(hexStr.substring(i, i + 2), 16)); bytes.put(b);//from www . j a v a2 s . co m } bytes.position(); try { decStr = new String(bytes.array(), "GBK"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return decStr; } }