I am currently using Java to communicate with device through Serial communication. I have to send packet in byte array. I did the following :
byte[] packet = new byte[3];
packet[0] = 'C'; //char form
packet[1] = 'C'; //char form
packet[2] = '2'; //char form
Is there any difference from initialize in this way :
byte[] packet = new byte[3];
packet[0] = 0x43; //hex form
packet[1] = 0x43; //hex form
packet[2] = 0x32; //hex form
The value should be the same, right?
Yes, they are absolutely the same. Both get converted to an
intwith the same value.