Send the 16-bit value as two 8-bit values

Original:

byte Data[2];
    B=B+1;
    Data[0]=data2[readIndex2]/256;
    Data[1]=data2[readIndex2]%256;
    if (A==1){
      if (B>=4){
      for(int j=0;j<2;j++)
Serial.write(Data[j]);

After the change:

byte Data[2];
    B=B+1;
    Data[0]=data2[readIndex2]/256;
    Data[1]=data2[readIndex2]%256;
    if (A==1){
      if (B>=4){
      for(int j=0;j<2;j++)
     Serial.write(0xCC);                  
     Serial.write((Data[j] >> 8) & 0xFF);   
     Serial.write((Data[j] & 0xFF);

I don't know if this change is feasible. Help me directly with questions. My idea is to send it in 2 passes.

int d16;
Serial.write(lowByte(d16));
Serial.write(highByte(d16));

GolamMostafa: int d16; Serial.write(lowByte(d16)); Serial.write(highByte(d16));

I was doing this the 'hard' way

Thanks

GolamMostafa: int d16; Serial.write(lowByte(d16)); Serial.write(highByte(d16));

or if you want to see what you do and not rely on Arduino's macros, just use shifting and masking

void setup() {
  Serial.begin(115200);
  int16_t w = 0xAABB;
  Serial.write(w & 0xff); // LsB
  Serial.write(w >> 8);   // MsB
}
void loop() {}

(you could use casting for documentation and type coherence but write will get the first byte only anyway)

and of course you could also let the write function do that for you:

void setup() {
  Serial.begin(115200);
  int16_t w = 0xAABB;
  Serial.write((uint8_t*) &w, sizeof(w)); // LsB first as little endian
}
void loop() {}