Hi guys,
I can't figure out how to proceed and whether I'm in the right way to resolve this task.
Pls, gimme a hint(s).
1. Should I fill a new 2d Array

*result*by adding the values from the two other arrays*result1 and result2*2. Which method(s) would be suitable here? Thank you in advance!package en.codegym.task.pro.task05.task0517;
import java.util.Arrays;
/*
Splitting an array
*/
public class Solution {
public static int[][] result = new int[2][];
public static int[] array = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
public static void main(String[] args) {
if (array.length % 2 == 0) {
int[] result1 = Arrays.copyOfRange(array, 0, array.length/2);
int[] result2 = Arrays.copyOfRange(array, array.length/2, array.length);
result = new int[result1.length][result2.length];
System.out.println(Arrays.deepToString(result));
} if (array.length % 2 != 0) {
int[] result1 = Arrays.copyOfRange(array, 0, array.length/2+1);
int[] result2 = Arrays.copyOfRange(array, array.length/2+1, array.length);
result = new int[result1.length][result2.length];
System.out.println(Arrays.deepToString(result));
}
}
}

result1' and 'result2' are calculating properly. The main problem is that lines 18 and 24 create a new multidimensional array while you never use 'result1' and 'result2'. You are going to need to set these toresult[0]andresult[1]. The correct answer to thearraybeing:{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}is thatresultshould be:{{1, 2, 3, 4, 5, 6}, {7, 8, 9, 10, 11}}-A tip-You can simply find the shorter and longer split by dividing the length by 2, which will always give the shorter size, and then subtracting that from length: For example, the array has a length of 11 in this task. If you divide that by 2 you get 5, which would be 'smallSize'. You then subtract 11 by 5 and you end up with 6. This is 'longSize', and you can use that to split the array properly withoutif-elseBecause in this task you don't even need the smallSize, this can be simplified to: