problems with receiving array through serial using xbees.

Hi, I am trying to send an array of values wirelessly from one arduino to another via xbee serial comm and I’m having some issues,weird thing is the first 15 or so sets of array values I receive are in perfect order as I want them but after that I start to get some random values(all integers) and I was wondering if any one knows how to help me out.
I don’t think there’s anything wrong with my code but a different set of eyes wont hurt
p.s …the values here are just dummy data for testing and yes xbees have the same baudrate

code for sending… arduino

int x = 1100;
int y = 300;
byte z = 8;
byte d = 5;
void setup() {
 
  Serial.begin(115200);
  
}


void loop() {
 
    sendData();
 
  
  
// Serial.flush();
}

void sendData()  // function to send data over serial.port 
{
  byte buf[] = {'<', 0, 0, 0, 0, 0, 0, '>'};   //bytes for data
  byte len = 8;                             // length of bytes to send

  buf[1] = (x >> 8) & 0xFF;  //MSB           
  buf[2] = (x) & 0xFF;       //LSB

  buf[3] = (y >> 8) & 0xFF;  //MSB         
  buf[4] = (y) & 0xFF;       //LSB

  buf[5] = z; 
  buf[6] = d ;
 
  Serial.write(buf, len);
  
  return;
}

code for receiving arduino

 byte buf [7];

void setup(void)
{

 Serial.begin(115200);

}

void loop(void)
{

  
 int arr[4];
 if (Serial.available() > 0){
 
 Serial.readBytesUntil('>', buf, 7);


 arr[0] = (buf[1] << 8)  | buf[2] & 0xFF; 
 arr[1] = (buf[3] << 8)  | buf[4] & 0xFF; 
 arr[2] = buf[5];
 arr[3] = buf[6]; 
  for (int i = 0 ; i < 4 ; i++) {
   Serial.print(arr[i]);
   Serial.print("   ");
   Serial.println(i);
 }
  delay(1000);
 }

}

#note … I have used code similar to this method for a “arduino to processing” communication. to send values to processing and it works fine

That's not proper way to receive the data.
The proper way is to receive data piece by piece (byte by byte) after each iteration of loop(). You have both start and end markers, so you know when your data starts and when it ends. Store the data when you ALREADY got the start marker. Process the data when you ARE receiving the end marker.

oh ok but i will also like to say that I was going through the data it receives and sometimes even after it receives the start marker, the rest of the data is wrong, any knowledge as to why?

Post your updated code and your new problems for further advices.