public static String printbyte(byte[] bt) { StringBuffer strBuffer = new StringBuffer(); for (int i = 0; i < bt.length; i++){ int hex = (int)bt[i] & 0xff; strBuffer.append(Integer.toHexString(hex) + " "); } return strBuffer.toString(); }
wchar_t a[] = L"杨彬abc"; char *p = (char *)a; for(int i= 0; i<sizeof(a); ++i){ cout<<hex<<(int)p[i]<< " " ; } cout<< endl ; for(int i= 0; i<sizeof(a); ++i){ cout<<p[i]<< " " ; }