// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.*;

public class ReadRandomBytes {
    public static void main(String[] args) throws IOException {
        RandomAccessFile raf = new RandomAccessFile("tst.txt", "r");
        for(int ix = 0; ix < (int)raf.length(); ix++) {
            System.out.println(ix);
            raf.seek(ix);
            int c = raf.read();
            System.out.println(c);
        }
        raf.close();
    }
}
