The French word that was translated to *stud* was *ferret*. I don't actually see any justification for translating *ferret* here as *stud*, as I will explain later.

To explain how the diamonds were worn first, these twelve diamond *ferrets* were part of a decoration meant to be worn on a shoulder. It was made of six blue ribbons woven or knotted together. The twelve *ferrets* were ornamental tips attached to the ends of the ribbons. 

The rest of the answer contains the justification for this statement. To see what *ferret* means, let us look at the definition from the [*Larousse dictionnaire de français.*]( This is

> Petit bout (en métal, en pierre précieuse, etc.) d'une aiguillette.  
Small tip (of metal, gemstone, etc.) of an aiguillette.

So what is an *aiguillette*? The English translation is aiguillette, but this won't help modern readers because the word has largely fallen out of use in both English and French (because aiguillettes aren't used much anymore). *Larousse* says that an *aiguillette* is

> Cordon, ganse ou tresse, ferré aux deux bouts, ayant, jusqu'au règne de Louis XIV, servi à fermer ou à garnir les vêtements.  
Cord or braid, tipped with metal at both ends, that until the reign of Louis XIV served to fasten or decorate clothing.  

So an *aguillette* was a small length of cord or braid, often tipped with precious metal or gemstones at both ends, that was used to fasten clothing closed, or which was worn purely for decoration.

One can see pictures of them in [English Wikipedia]( This says

> Portraits of the 16th and 17th centuries show that aiglets or metal tips could be functional or purely decorative, though many were used to "close" seams and slashes that are not always apparent on dark garments in portraits. They were made in matched sets, might be of silver, silver-gilt, or gold, and were worn in masses.

Here is a 1562 picture of Lord High Admiral Clinton wearing a doublet fastened by aiguillettes, from Wikipedia.

[![Lord High Admiral Clinton in an arming doublet of 1562][1]][1]

So were the diamonds on aiguillettes? If they were, *stud* might be a reasonable translation of *ferret*, because a stud is a piece of jewelry that you use to fasten two buttonholes together, and similarly an aiguillette is a piece of jewelry you use to fasten your clothing. 

However, in this case, the *ferrets* were not on aiguillettes, although they were indeed on the ends of ribbons. A later description of 
the diamonds in *Le Comte de Monte Cristo* follows:

> Tenez, lui dit-il en tirant du coffre un gros noeud de ruban bleu tout étincelant de diamants; tenez, voici ces précieux ferrets ...  
“Here,” said he, drawing from the casket a large knot of blue ribbon all glittering with diamonds, “here are the precious *ferrets* ...

Note that the French word *noeud* is broader than the English word *knot*; a bow would also be called a *noeud*. 

So the *diamonds* are in a large decoration made of blue ribbon. We also find that this was meant to be worn on a shoulder. This decoration must then be made of six blue ribbons knotted or woven together somehow, and the *diamonds* are on pieces of jewelry which are affixed to the twelve ends of these six ribbons. They may be intended to dangle around the shoulder like the fringe on an epaulette.