public class T1
{
static int k = 0;
static String[] puts = new String[0];
public static void main ( String[] args )
{
File file = new File ("I:/WinRAR");
List list = new ArrayList ();
listFiles (file, list);
System.out.println (list);
System.out.println (list.size ());
System.out.println (Arrays.toString (puts));
System.out.println (puts.length);
}
private static void listFiles ( File file, List list )
{
if (file.isDirectory ())
{
File[] files = file.listFiles ();
for ( File f : files )
{
if (f.isDirectory ())
{
listFiles (f, list);
}
else
{
if (puts.length == 0)
{
puts = new String[1];
}
else
{
String[] temp = new String[k + 1];
System.arraycopy (puts, 0, temp, 0, puts.length);
puts = temp;
}
puts[k] = f.getPath ();
k++;
list.add (f.getAbsolutePath ());
}
}
}
else
{
if (puts.length == 0)
{
puts = new String[1];
}
else
{
String[] temp = new String[k + 1];
System.arraycopy (puts, 0, temp, 0, puts.length);
puts = temp;
}
puts[k] = file.getPath ();
k++;
list.add (file.getAbsolutePath ());
}
}
}