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