Here you can find the source of getFreeSpace(String pathname)
public static long getFreeSpace(String pathname) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; public class Main { public static long getFreeSpace(String pathname) throws IOException { return (new File(pathname)).getUsableSpace(); }/*from w w w . j a v a 2 s . c o m*/ }