would some one be kind enough to copy and paste and compile this code, I get no results to the terminal, my criteria should bring a few results
import java.io.*;
import java.util.*;
public class MainFourA
{
public static void main(String[] args)
{
File[] filesOnComputer = File.listRoots();
ArrayList listOfFiles = new ArrayList();
System.out.println (filesOnComputer.length);
for(int index = 0; index < filesOnComputer.length; index++)
{
listOfFiles.add((File)filesOnComputer[index]);
if(filesOnComputer[index].isDirectory())
{
System.out.println ("here we are-"+filesOnComputer[index].getPath());
search((File)listOfFiles.get(index));
}
else
System.out.println ("This is not the directory-"+filesOnComputer[index].getPath());
}
}
public static void search(File f)
{
try
{
ArrayList<File> arrayList = new ArrayList<File>();
ArrayList<File> arrayListAgain = new ArrayList<File>();
File[] files= f.listFiles();
for(int index = 0; index < files.length; index++)
if (files[index].isDirectory())
{
search(files[index]);
}
else if (files[index].isFile())
{
System.out.println ("here we are---" + files[index].getName());
arrayList.add(files[index]);
arrayListAgain.add(files[index]);
if (arrayList.get(index).length() == arrayListAgain.get(index).length() &&
arrayList.get(index).hashCode() != arrayListAgain.get(index).hashCode())
{
System.out.println (arrayList.get(index).getName() + ", " + arrayList.get(index).length() + " bytes.");
}
}
System.out.println (f.getName());
}
catch (Exception e)
{
}
}
}
it compiles, if you comment out the big if statement, then lots of results come to the terminal window
I hope know one is getting annoyed by me!