Home > other >  0 xaa converted to AA?
0 xaa converted to AA?

Time:10-18

Want to 0 xaa, 0 x55, 0 x00 converted to AA, 55, 00, how does this conversion? And then in the AA, 55, 00, on a Byte array {} AA, 55, 00; The
How to get?

CodePudding user response:

Someone didn't? To the top

CodePudding user response:

Don't quite understand, is to convert hexadecimal integer to the corresponding string? Oneself write a small program work it out

CodePudding user response:

Java write:
String s="0 x1234";
System. The out. Println (s.s ubSequence (2, s.l ength ()));
As to what you said in the byte array inside said don't understand, Sting has getBytes this method, can only help you to it, you didn't ask question

CodePudding user response:

String s="0 x1234";
System. The out. Println (s.s ubString (2, s.l ength ())); Sent you a wrong

CodePudding user response:

Is converted to AA type can directly into the byte array?

CodePudding user response:

reference 4 floor Dylan_ZJ response:
String s="0 x1234";
System. The out. Println (s.s ubString (2, s.l ength ())); Sent you a wrong
is what I want to convert a string into the byte array is then {00 AA,}; Before xaa is 0, 0 x00 0 x removed

CodePudding user response:

Int a=0 xaa

Cstrings strText="";
StrText. The Format (" % 02 x ", a);

CodePudding user response:

Demand should not realize, you just use them to form a byte array is {x55 0 xaa, 0, 0 x00}, should not be converted to the string "AA" "55" "00" to byte,

CodePudding user response:

Right, is now I have encountered such a problem is to send data in time there will be a close the client's problem, when the client connection timeout time the client will automatically shut down, then the server will also receive message but I did not respond to a connection timeout setting how to return a responsibility

CodePudding user response:

The above this problem has been solved
  • Related