title: Java replace string with increasing number
body: <p>I want to replace "a" of "abababababababab" with 001,002,003,004......
  that is "001b002b003b004b005b....."</p>
  
  <pre><code>int n=1
  String test="ababababab";
  int lo=test.lastIndexOf("a");
  while(n++&lt;=lo) Abstract=Abstract.replaceFirst("a",change(n));
  //change is another function to return a string "00"+n;
  </code></pre>
  
  <p>however this is  poor efficiency,when the string is large enough,it will take minutes!</p>
  
  <p>do you have a high efficiency way?
  thanks very much!</p>