转换16进输出代码

    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]<< " " ;
         }

猜你喜欢

转载自yangbinfx.iteye.com/blog/1960002
今日推荐