Java tutorial
import java.io.*; public class Main { public static void main(String[] args) { try { short s = 15000; RandomAccessFile raf = new RandomAccessFile("c:/test.txt", "rw"); // write something in the file raf.writeShort(s); // set the file pointer at 0 position raf.seek(0); // print the short System.out.println(raf.readShort()); // set the file pointer at 0 position raf.seek(0); // write something in the file raf.writeShort(134); // set the file pointer at 0 position raf.seek(0); // print the short System.out.println(raf.readShort()); raf.close(); } catch (IOException ex) { ex.printStackTrace(); } } }