class="java">import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
public class BigFileTester {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
int cap = 4 * 1024 * 1024;
long start = System.currentTimeMillis();
RandomAccessFile r = new RandomAccessFile("D:\\test.txt", "rw");
r.setLength(cap);
r.close();
long duration = System.currentTimeMillis() - start;
System.out.println(duration + " ms");
}
}