title: Merge more than 100 json files to one file using java code
body: <p>I try to put more than 100 similar jsonArray to one file, but I cannot resolve how I can name jsonArray`s name as variable in &quot;for cycle&quot; in java.
  Please, help me. All questions that I found here about 2-3 jsonArrays with final names.</p>
  <pre><code>
  for (int j=1; j&lt;10; j++) {
      
  
          //StringEntity json2 = new StringEntity(&quot;c:/test/test.txt&quot;);
  
          FileInputStream fileInputStream = null;
          String data=&quot;&quot;;
          StringBuffer stringBuffer = new StringBuffer(&quot;&quot;);
          try{
              br = new BufferedReader(new InputStreamReader(
               new FileInputStream(&quot;c:/test1/jsonparser&quot; + j +&quot;.json&quot;), &quot;UTF-8&quot;));
              
              
              int i;
              while((i=br.read())!=-1)
              {
                  stringBuffer.append((char)i);
              }
              data = stringBuffer.toString();
          }
          catch(Exception e){
                  //LoggerUtil.printStackTrace(e);
          }
          finally{
              if(fileInputStream!=null){  
                  fileInputStream.close();
              }
          }
        
  
         JSONTokener tokener1 = new JSONTokener(data);
         JSONObject json1 = new JSONObject(tokener1);
       
         JSONArray sourceArray = new JSONArray(json1);
          JSONArray destinationArray = new JSONArray();
  
          for (int i = 0; i &lt; sourceArray.length(); i++) {
          destinationArray.put(sourceArray.getJSONObject(i));
                  }
  
          String s3 = destinationArray.toString();
  
          System.out.println(s3);
  </code></pre>