import java.io.File; import java.io.RandomAccessFile; import junit.framework.TestCase; public final class FileTest extends TestCase { public void testSetLastModified() throws Exception { File file = new File("/mnt/sdcard/testSetLastModified"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); long length = raf.length(); raf.setLength(length + 1); raf.setLength(length); raf.close(); System.out.println("Created " + file); System.out.println("Last modified: " + file.lastModified()); } }