Skip to content

Instantly share code, notes, and snippets.

@mariiaKolokolova
Created May 3, 2020 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariiaKolokolova/c17e51eba0d12a3bceb9f54125519892 to your computer and use it in GitHub Desktop.
Save mariiaKolokolova/c17e51eba0d12a3bceb9f54125519892 to your computer and use it in GitHub Desktop.
package maricka.kolokolova;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] massS = new int[15];
int[] massF = new int[30];
for (int i = 0; i < massS.length; i++) {
massS[i] = (int) (Math.random() * 10);
}
System.out.println("Initial array: " + Arrays.toString(massS));
System.arraycopy(massS, 0, massF, 0, massS.length);
for (int i = 0; i < massF.length / 2; i++) {
massF[i + massF.length / 2] = massF[i] * 2;
}
System.out.println("Result: " + Arrays.toString(massF));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment