public class TableauRelatif {

    private int[] tab;
    private int debut;

    public TableauRelatif(int debut, int fin) {
        if (fin < debut) throw new IllegalArgumentException();
        this.debut = debut;
        this.tab = new int[fin - debut];
    }

    public int actual(int i) {
        if (i < this.debut || i > this.debut + this.tab.length)
            throw new ArrayIndexOutOfBoundsException(i);
        return i - this.debut;
    }

    public int get(int i) {
        return this.tab[this.actual(i)];
    }

    public int set(int i, int v) {
        this.tab[this.actual(i)] = v;
    }

}
