Cavity formation due to a contact between particles in a nonwetting liquid