日期:2014-05-19 浏览次数:20736 次
public static void main(String[] args) throws Exception { String str = "E4B88B"; //String str = "E38082"; int len = str.length()/2; byte[]data = new byte[len]; for(int i = 0;i < len;i++){ String temp = str.substring(2*i,2*(i+1)); data[i]=(byte)Integer.parseInt(temp,16); } String newstr = new String(data); System.out.println(newstr); }