I saw a old post and I have tried it. It does work, but I couldn't understand it well.
I use it as follow:
RandomAccessFile raf;
...
raf.write((byte)4);
...