Create array of incremental int using Stream instead of for loop
There is already a built-in method for that:
int[] array = IntStream.range(start, start + length).toArray();
IntStream.range
returns a sequential ordered IntStream
from the start (inclusive) to the end (exclusive) by an incremental step of 1.
If you want to include the end element, you can use IntStream.rangeClosed
.