Getting the length of an array of objects

Trying to use a call to the File.listRoots method in java which returns a list of the root file systems (Windows drives in my case) available to me as an array of File objects.  I'm trying to figure out how to get the number of root file systems returned so I can iterate through and can't seem to get it.  Any help would be appreciated.

Sample Code

01 class1 type performance.
01 diskdrive type File.
01 rootpath string.
01 writeable type boolean.
01 drives type File occurs any.
01 i binary-long.
01 freespace type long.
procedure division using by value args as String occurs any.
set class1 to new performance.
set drives to type File::listRoots().
perform varying i from 1 by 1 until i > 4
set rootpath to drives(i)
set diskdrive to new File(rootpath)
set writeable to diskdrive::canWrite()
set freespace to diskdrive::getFreeSpace()
display "Free Space = " freespace
end-perform.

Java - essentially I want the value in roots.length

        // Determine all the root paths for the system.
        File[] roots = File.listRoots();

        System.out.println("The system contains root paths:");
        for (int i = 0; i < roots.length; i  )
        {
            System.out.println("\t"   roots.getAbsolutePath());
        }
    }
Parents Reply Children
No Data