How can I format a number to the fixed locale?
<p>How can I insert to a string comma (,) after every 3 position starting from last?  </p>

<pre><code>input             desired output    

9876567846678     9,876,567,846,678  
567               567
1234              1,234
</code></pre>

<p>I used one method like first divide the whole string by three position and then while merging appending coma by three three position.</p>

<p>Is there any better solution? Is there function available to do this trick in java? </p>

<p><strong>Edit :</strong><br>
LAS_VEGAS answer will format the number based on the locale.  But i want to format it to a fixed locale ...<br>
how can i do tht?</p>
