Problem with receiving data from Arduino via HC05 sent by Java

I want to both send some sensor data via Bluetooth (HC05) and Arduino to Java and I also want to send some command data via the same Bluetooth and serial port to Arduino.
I’ve managed to do the first part (arduino to java) successfully with this code:

hc05SerialEx.printf("^%d,%7.3f,%d,%7.3f,%d,%7.3f\n", s1, ss1, s2, ss2, s3, ss3);

^ is the character I devised in my simple protocol and it means the starting point of data.
@ means starting point of command packet.

The problem is whenever I want to write a char packet via the same HC05 connection to arduino, it sometimes works. In fact, whenever I click the button firing the write method, I see the packet received correctly but when I click the button again or click it rapidly, it sometimes outputs garbage in arduino side.
I do have delay in my main loop in arduino side and I’m using it to control the sampling rate of sensors. I’ve timed arduino side’s calculation time (except delay of course) and it takes about 52 milliseconds.
I suspect whenever I fire the write method while arduino is busy in main loop, the received data becomes gibberish. So here are the questions:

1- What is the cause of this problem?
2- How can I achieve the goal I mentioned?

Here is java-side code sending the command packet:

String message = String.format("@%5.3f,%5.3f,%5.3f\n", rmR1, rmR2, rmR3);
System.out.println(message);
rightHC05Port.write(message);

Here is the related arduino-side code receiving and mirroring the received packet in arduino’s own serial port (for me to see):

#include <SPI.h>
#include <SoftwareSerial.h>
#include <PrintEx.h>

/* Bluetooth module (hc05) pins
   ArduinoUno6 = RX (connected to hc05's TX)
   ArduinoUno7 = TX (connected to hc05's RX via resistive divider (mind 3.3V))
*/

SoftwareSerial hc05Serial(6, 7);

/* Extended Serial Port (support for float printf)
   arduinoSerialEx = Serial (should be begun)
   hc05SerialEx = hc05
*/
PrintEx arduinoSerialEx = Serial;
PrintEx hc05SerialEx = hc05Serial;

void setup() {
  // Beginning the Serial Ports
  Serial.begin(9600);
  hc05Serial.begin(9600);

  // Beginning the SPI protocol
  SPI.begin();

}
void loop() {
  serialEventHC05(); 
  //fetching sensor data and some math operations...
  hc05SerialEx.printf("^%d,%7.3f,%d,%7.3f,%d,%7.3f\n", s1, ss1, s2, ss2, s3, ss3);
  delay(loopTime);

int numOfReceivedBytes = 0;

void serialEventHC05() {
  while (hc05Serial.available() > 0) {
    numOfReceivedBytes = hc05Serial.available();
    String s = hc05Serial.readStringUntil('\n');
    arduinoSerialEx.println(numOfReceivedBytes);
    if (s.charAt(0) == '@') {
      arduinoSerialEx.println(s);
    }
  }
}

For example, here is the string I’m sending from Java via HC05 to Arduino:

@10.000,10.000,10.000

And here is the result of Arduino’s behavior caused by me sending the same packet multiple times:
Arduino’s mirrored received packet

Any help is appreciated.

P.S. I’ve posted this also on Arduino.StackExchange.com but that site is still in beta. I thought there would be more people here who could answer this problem.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example.

...R