代码如下(示例):
import java.io.File;2.读入数据
代码如下(示例):
public class MaxFreeSpace
{
static File[] files = File.listRoots();
public static void main(String[] args) {
zui(files);
}
public static File zui(File[] files) {
Long[] str = new Long [files.length];
int max = str.length - 1;
for (int i = 0; i < str.length; i++) {
str[i] = files[i].getFreeSpace();
}
for (int i = 0; i < str.length - 1; i++) {
if (str[i] > str[i + 1]) {
Long j = str[i];
str[i] = str[i + 1];
str[i + 1] = j;
str[max] = str[i + 1];
}
}
for(int i =0;i
总结
最后实在是不知道返回什么了,就只能先返回一下File数组里的一个元素先应付一下了。
Emmm…我是个Java初学者,代码可能还有很多地方要改的,也是第一次写博客,恳请大佬们能给出一些宝贵的建议,我再此谢谢大佬的指点!!



