title: Passing the correct file based on the string ouput
body: <p>I have the following code which merges two audio files into one:</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import java.io.SequenceInputStream;
  import javax.sound.sampled.AudioFileFormat;
  import javax.sound.sampled.AudioInputStream;
  import javax.sound.sampled.AudioSystem;
  
  public class WavAppender {
      public static void main(String[] args) {
          String wavFile1 = "D:\\wav1.wav";
          String wavFile2 = "D:\\wav2.wav";
  
          try {
              AudioInputStream clip1 = AudioSystem.getAudioInputStream(new File(wavFile1));
              AudioInputStream clip2 = AudioSystem.getAudioInputStream(new File(wavFile2));
  
              AudioInputStream appendedFiles = 
                              new AudioInputStream(
                                  new SequenceInputStream(clip1, clip2),     
                                  clip1.getFormat(), 
                                  clip1.getFrameLength() + clip2.getFrameLength());
  
              AudioSystem.write(appendedFiles, 
                              AudioFileFormat.Type.WAVE, 
                              new File("D:\\wavAppended.wav"));
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>I will have a string in the following format [1,2,3,4,5]. Based on the string I will need to select the appropriate wav file. For example if the string is in the format [3,4,5,6,7], I will need to send wavfile 3, wavfile4, wavfile5, wavfile6 and wavfile 7. What is the best way to achieve this?</p>