RandomAccessFile.writeLong(long v) has the following syntax.
public final void writeLong(long v) throws IOException
In the following code shows how to use RandomAccessFile.writeLong(long v) method.
// ww w . ja va2s . c om import java.io.*; public class Main { public static void main(String[] args) { try { long f = 123456789909876L; RandomAccessFile raf = new RandomAccessFile("c:/test.txt", "rw"); raf.writeLong(f); raf.seek(0); System.out.println(raf.readLong()); raf.seek(0); raf.writeLong(20000000000l); raf.seek(0); System.out.println(raf.readLong()); raf.close(); } catch (IOException ex) { ex.printStackTrace(); } } }