suponiendo que el texto esta en un objeto tipo string "str
Código Java:
Ver originalfor(i=0;i<str.length;i+=3)
{
aux+=str.substring(i,i+3)+",";
}
str=aux;
algo así seria la idea,probablemente tenga fallos" index out of bounds"porque lo he hecho rapidamente y sin pensar jeje...