The usage of i - 1 concerns me the most. Should i use another variable for the indexing or is this fine?
public class MainClass {
    public static void main(String[] args) {
        int[] array = new int[5];
        for(int i = 1; i<=array.length; i++) {
            array[i-1] = i;
        }
        for(int x: array)
            System.out.println(x);
    }
}
 
    