title: Java String Concatenation using Array
body: <p>I know that there exists a package that supports handling biological information such as Biojava , but I want to make a simple code which will convert a DNA sequence into a complement sequence of it</p>
  
  <p>Here is my code...</p>
  
  <pre><code>public class SeqComplement{
      static String sequence ;
      String Complement(String sequence){
          // this.sequence = sequence;
          // String complement;
          // complement = "N";
          // for(int i = 0 ; i&lt; sequence.length() ; i++){
          String[] raw = new String[sequence.length()];
          String[] complement = new String[sequence.length()];
          String ComplementSeq = "N";
          for(int i = 0 ; i &lt;sequence.length() ; i++){
              String sub = sequence.substring(i,i+1);
              raw[i] = sub;
              }
          for(int j = 0 ; j &lt; sequence.length();j++){
              if(raw[j] == "A"){
                  complement[j] = "T";
                  }
              else if (raw[j] == "T"){
                  complement[j] = "A";
                  }
              else if (raw[j] == "G"){
                  complement[j] = "C";
                  }
              else if (raw[j] == "C"){
                  complement[j] = "G";
                  }
              else{
                  complement[j] = "N";
                  }
              }
          for(int k = 0 ; k &lt; complement.length ; k++){
              ComplementSeq+=complement[k];
              }
          return ComplementSeq.substring(1);
          }
  
  
      public static void main(String[] args){
          SeqComplement.sequence = "ATCG";
          SeqComplement ob = new SeqComplement();
          System.out.println(ob.Complement(ob.sequence));
      }
  }
  </code></pre>
  
  <p>This code gave result as NNNN</p>
  
  <p>I already tried using String.concat() method, but it gave me nothing.</p>