Question: I am trying to increment an array of 5 in Java by 100 starting at 0(to get the output of: 0,100,200,300,400). For some reason my for loop will not add 100 and when I run the program, it just prints 0,0,0,0,0. Any help would be appreciated. 

```
public class Integers {

    void createIntegers(int[] arr) {
        for (int n = 0; n < arr.length; n += 100);
    }

    void printIntegers(int[] arr) {

        int index;

        for (index = 0; index < arr.length; index++) {
            System.out.println(arr[index]);
        }
    }

    public static void main(String[] args) {

        int[] arr = new int[5];

        Integers createIntegers = new Integers();
        createIntegers.createIntegers(arr);
        createIntegers.printIntegers(arr);

    }
}

```

Answer: 
It is very easy, you need only slight change :

```
public class Integers {
    void createIntegers(int[] arr) {
        for (int n = 0; n < arr.length; n++){
            arr[n] = 100*n;
        }                
    }

    void printIntegers(int[] arr) {
        for (int index = 0; index < arr.length; index++) {
            System.out.println(arr[index]);
        }
    }

    public static void main(String[] args) {
        int[] arr = new int[5];
        Integers createIntegers = new Integers();
        createIntegers.createIntegers(arr);
        createIntegers.printIntegers(arr);
    }
}

```

The problem was in your `createIntegers` method. You did not do anything with array, you were just incrementing variable `n`

---

What does this `for (int n = 0; n < arr.length; n += 100);` do:

`int n = 0` ->This is executed only once on the beggining of the whole for construct. You declare variable `n` and set its value to zero.

`n < arr.length` ->As long as this condition is true on the beggining of new cycle, the cycle is running.

`n += 100` -> This is executed at the end of each cycle. However incrementing variable n by 100 does not change anything in array.
Looks like you need to read up a bit on the basics, here's some sample code to help you achieve what your trying to do. Your code is not doing as expected since your for condition is just looping but not actually assigning anything. 

```
public class Test {

private static int[] myIntegers = new int[5];
private static int incrementor = 100;

public static void main(String args[]) {

    // Add values to the array
    for (int i = 0; i < myIntegers.length; i++) {
        myIntegers[i] = incrementor;
        incrementor += 100;
    }

    // Print out the array
    for (int i = 0; i < myIntegers.length; i++) {
        System.out.println(myIntegers[i]);
    }

}

}

```