looping to read multiple files from different folders of a hierarchy
<p>I have a code which retrieves multiple objects from a folder, de-serializes it and add it to a string array</p>

<pre><code>public static String[] play(){
    int i = 0;
    List&lt;String&gt; args = new ArrayList&lt;String&gt;();
      while (true) {
        try {
            args.add(processFile(i));
            System.out.println(i);
            i++;
        } 
        catch (Exception e) {
          System.out.println("No more files");
          break;
        }
      }  
      String[] array = args.toArray(new String[0]);
      return array;
 }       
private static String processFile(int fileNumber) throws Exception {
    File file=new File("E:/proj/"+fileNumber+".bin");
    FileInputStream fin=new FileInputStream("E:/proj/"+fileNumber+".bin");

    //reading the byte content of the bin files
    byte fileContent[] = new byte[(int)file.length()];
    fin.read(fileContent);

    //store the deserialized object that is returned to an object.
    Object obj=serializer.toObject(fileContent);

    //converting the obtained object to string and storing it to args, a string[]
    String word=obj.toString();
    return word;
}
</code></pre>

<p>} </p>

<p>This sample code, retrieves the message opening the "seconds" folder following this hierarchy.<a href="http://i.stack.imgur.com/M4MO6.jpg" rel="nofollow">TIMESTAMP CHART</a> this folder can be seen last.The storage of the serialized bin files is such, that the number of bin files create in one second are stored in that "seconds" folder. That is, if a bin is created at 17:15:32 pm, the bin file would be stored under a the folder of 2012 year->3 month->21 date->17 hours-> 15 mins->32 seconds -> 1 or more bin file depending on how many were created at that second.</p>

<p>If i have to normally retrieve bin files from this hierarchy, i can do it successfully for the time is input by the user. But if a time interval is given say retrieve all the bin files from 17:15:35 to 17:20:35;where i would have to return all the bin files obtained at 35th second of 15th min,36th second of 15th min....1st second of 16th mins and so on till 35 seconds of 20 mins; thereby completing a time window of 5 mins exactly and retrieving all the bin files in this interval.Also, it is not necessary that a bin file has to be published every second, as in, it may happen that for a second or a minute even, no bin files were created, so that second/minute folder does not exist in the hierarchy. That is, maybe for 17:18:0 to 17:19:0, no bin files were created; for may/maynot consistency of creation of bin files.  And all the data of the bin files have to be stored in one string array. 
No matter how i loop it, i couldnt achieve the desired result so i put up elementary code here. How do i go about doing it? Please help</p>
