java检测磁盘空间大小

public  long checkSpace(){
        String path = System.getProperty("user.dir");
        System.out.println("path=="+path);
        File file = new File(path);
        long freeSpace = file.getFreeSpace();
        long diskSpace = freeSpace / 1024 / 1024/1024;
        return diskSpace;
    }

你可能感兴趣的:(笔记,java,jvm,开发语言)