Problem of confirm bluetooth data

I can send file from android to arduino.
I use mega2560,HC06 and music shield.
how can I confirm the data is correct?
I have transfered .aac file failed.
It’s can play in Mega2560.
I can transfer .txt file sucessfully.

Arduino code

char buffer[1];
      int incomingByte=0;
      if(Serial.available()>0 )
      {
          myFile = SD.open("C3.aac", FILE_WRITE);
      }   
        
      while( Serial.available()>0 )
      {
          incomingByte=Serial.read(); 
          myFile.write(incomingByte);  
          //Serial.println(myFile.size());   
      }
      if(myFile.size()!=0)
        Serial.println(myFile.size());
      myFile.close();

Android code

String path = Environment.getExternalStorageDirectory().getPath();
		File file = new File(path + "/" + "b.aac");

		try {

			FileInputStream fin = new FileInputStream(file);
			ByteArrayOutputStream byteBuffer=new ByteArrayOutputStream();
			//byte[] data=new byte[1];
			//byte[] data = new byte[25712];
			byte[] data = new byte[1];
			int length = 0;
			while ((length = fin.read(data)) != -1) {
				Log.i("Length", "" + length);
				byteBuffer.write(data, 0, length);
				Bluetooth.connectedThread.writeByte(data);
				Log.i("DATA MESSAGE", "" + data);
			}
			fin.close();
			Log.i("TAG OVER", "OK OK OK OK OK OK OK OK OK");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

writeByte function

public void writeByte(byte[] data) {

			try {
				mmOutStream.write(data);
				//for(int i=0;i<income.getBytes().length;i++)
				//	Log.v("outStream"+Integer.toString(i),Character.toString((char)(Integer.parseInt(Byte.toString(income.getBytes()[i])))));
				try {
					Thread.sleep(20);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			} catch (IOException e) { }
		}