// 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.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;

public class Gen2 {
    public static void main(String[] args) throws IOException {
        ByteBuffer bb = ByteBuffer.allocate(3);
        bb.order(ByteOrder.LITTLE_ENDIAN);
        byte b = 0x41;
        bb.put(b);
        short s = 0x4243;
        bb.putShort(s);
        bb.rewind();
        FileOutputStream fos = new FileOutputStream("/Work/z2.txt");
        FileChannel fc = fos.getChannel();
        fc.write(bb);
        fc.close();
        fos.close();
    }
}
