title: How to concat 2 files
body: <p>How can i concat two files. </p>
  
  <p>I have two audio parts (each contains about 3 seconds of audio from the same source).
  I'm trying to merge those two files and play theme with the android mediaplayer.
  At the moment i'm using the method below, which works fine but takes a lot of time (around 13 seconds on my galaxy nexus). </p>
  
  <p>So my question is, is there a way to do this faster?</p>
  
  <pre><code>   public static void merge(File audioFile1, File audioFile2, File outputFile){
      long timeStart= System.currentTimeMillis();
      try {
  
          FileInputStream fistream1 = new FileInputStream(audioFile1);
          FileInputStream fistream2 = new FileInputStream(audioFile2);
          SequenceInputStream sistream = new SequenceInputStream(fistream1, fistream2);
          FileOutputStream fostream = new FileOutputStream(outputFile);
  
          int temp;
  
          while( ( temp = sistream.read() ) != -1)
          {
  
              fostream.write(temp);  
          }
  
          fostream.close();
          sistream.close();
          fistream1.close();          
          fistream2.close();
      } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      long timeEnd= System.currentTimeMillis();
  
      Log.e("merge timer:", "milli seconds:" + (timeEnd - timeStart));
  }
  </code></pre>