title: java - how to add - every after 3rd digit of String number
body: <p>i have contact number which i am getting from parameter which is of type String.</p>
  
  <pre><code> String pharmacyPhone = "123456789";
  </code></pre>
  
  <p>here i want to add - after every 3rd digit and before 4th digit</p>
  
  <p>so the output will become like <code>pharmacyPhone = 123-456-789.</code></p>
  
  <p>so how to achieve this?</p>