title: Sequence in java
body: <p><a href="https://i.stack.imgur.com/PHROu.png" rel="nofollow noreferrer">enter image description here</a>I am trying to write down a code in java that gives every line in my output file a  sequence depending on the changes on a string in the same line for exampl : </p>
  
  <pre><code>line1 = xx1x1xxxx
  line2 = xx1x2xxxx
  line3 = xx1x3xxxx
  line1 = xx2x1xxxx
  line2 = xx2x2xxxx
  line3 = xx2x3xxxx
  </code></pre>
  
  <p>this is my code but it doesn't work :</p>
  
  <pre><code>        String seq_flot;
          String seq_flot_old ;
          int compteur = 0;
  
          if(action.equals("RP")){
  
              seq_flot = line.substring(42,47);
              seq_flot_old = line.substring(42,47);
              if (seq_flot != seq_flot_old){
                  compteur=1;
                  line = line.replace("\\", compteur);
                  compteur = compteur+1;
                  seq_flot_old = seq_flot;
              }
              else if (seq_flot == seq_flot_old) {
                  line = line.replace("\\", compteur);
                  compteur = compteur+1;
                  seq_flot_old = seq_flot;
              }
  
              }
  </code></pre>