Java - Search and Replace part of a String
<p>I wanted to write a short programm, which replaces the Counting of a String. So I would like to start the String with 0 insted of 1. And Because it is a long String i dont want to change it all by my own. 
So the String (in this example) is: String LINE:</p>

<ol>
<li>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore </li>
<li>magna aliquyam erat, sed diam voluptua. </li>
<li>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum </li>
<li>dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore</li>
<li>magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, </li>
<li>no sea takimata sanctus est Lorem ipsum dolor sit amet.</li>
</ol>

<p>And I want the String to start the counting with 0. </p>

<pre><code>    public static void main(String[] args) {


    int Counter = 1;

    while (Counter &lt;=300){
        int counter2 =1;
        String Counterstring ;
        Counterstring = (new Integer(counter2)).toString() + ".";
        int ReplaceCounting = 0;
        String Replace = (new Integer(ReplaceCounting)).toString() + ".";
        Line.replace(Counterstring , Replace);

        Counter++;

    }

    System.out.println(Line);

}
</code></pre>

<p>}</p>

<p>Can somebody tell me what I did wrong?
The output is just the same.</p>

<p>EDIT:</p>

<p>I changed it into:
I changed it in: </p>

<pre><code>   public static void main(String[] args) {




    for (int counter = 1; counter &lt;= 300; counter++) {

        int NormCounter =1;
        int ReplaceCounter = 0;

        String NormCounterS  = (new Integer(NormCounter)).toString() + ".";


        String ReplaceCounterS = (new Integer(ReplaceCounter)).toString() + ".";
        Line = Line.replace(NormCounterS , ReplaceCounterS);
        ++ReplaceCounter;

        ++NormCounter;



    }

    System.out.println(Line);

}
</code></pre>

<p>}</p>

<p>But it still changes the first "1."  into "0."... So its 0,2,3,4... But i want the counting to go 0,1,2,3,4 </p>
