I have to make a program that extract every 3th element from array. So far i have made the basic array, but im stuck at extracting every 3th element into separate array. How can i do that?
public static void main(String[] args) {
int min = -100;
int max = 100;
int[] array = new int[201];
for( int i = 0; i < array.length; i++) {
array[i] = min + (int)(Math.random()*((max - min) + 1));
%operatorforloop you can iterate through an array with whatever step you want. For instancefor (int i = 0; i < array.length; i+=3)