As I assumed it's very easy. Representing integer-values in two bytes:
int x = 108;
byte x1 = (byte)((x >> 8) & 0xFF);
byte x2 = (byte)((x >> 0) & 0xFF);
题
The rfb protocol defines that for a position-transmitting (x,y) each value has to be represented in two bytes. So how to represent (108,284) in a byte-array where the protocol defines the parameters as follows:
byte[] clientMessage = new byte[] { messageType, btnMask, x, x, y, y}
解决方案
As I assumed it's very easy. Representing integer-values in two bytes:
int x = 108;
byte x1 = (byte)((x >> 8) & 0xFF);
byte x2 = (byte)((x >> 0) & 0xFF);