Skip to content

Instantly share code, notes, and snippets.

@kryvoboker
Created May 10, 2020 17:29
Show Gist options
  • Save kryvoboker/f26197d438e402d62052ef2b2f82e903 to your computer and use it in GitHub Desktop.
Save kryvoboker/f26197d438e402d62052ef2b2f82e903 to your computer and use it in GitHub Desktop.
HomeWork5
import java.util.Arrays;
/**
*
* @author kamaz
*/
public class Main {
public static void main(String [] args) {
int [] array = new int [15];
for (int i = 0; i < array.length; i++) {
array [i] = (int) (Math.random() * 15);
}
System.out.println(Arrays.toString(array));
int [] arrayTwo = Arrays.copyOf(array, 30);
for (int i = 15; i < arrayTwo.length; i++) {
arrayTwo[i] = arrayTwo[i - 15] * 2;
}
System.out.println(Arrays.toString(arrayTwo));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment