As of Java-9, there exists IntStream.html#iterate(seed, hasNext, next)
If you are trying to get a comma separated list of speeds, use:
String allSpeeds = IntStream.iterate(minKmh, i -> i <= maxKmh, i -> i + step)
.mapToObj(Integer::toString)
.collect( Collectors.joining( "," ) );
If you just want the integer array of speeds:
int[] speeds = IntStream.iterate(minKmh, i -> i <= maxKmh, i -> i + step).toArray();
Or, if you want the array of speeds as Strings:
String[] allSpeedsAsArray = IntStream.iterate(minKmh, i -> i <= maxKmh, i -> i + step)
.mapToObj(Integer::toString)
.toArray();
Finally, improving @bowman's solution, slightly:
int[] speeds = IntStream.iterate(minKmh, i -> i <= maxKmh, i -> i + step).toArray();
Although, the above solutions require step > 0
or they may not terminate, where as Bowman's solution works fine with negative step sizes.