Could you please advise where is the problem with my solution? Result is as expected so I don't understand why it's failed.
Thank you in advance.
Alena
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) {
int x = array.length/2;
if(x%2 == 0){
result[0] = Arrays.copyOfRange(array,0,x);
result[1] = Arrays.copyOfRange(array,x,array.length);
}
else {
result[0] = Arrays.copyOfRange(array,0,x+1);
result[1] = Arrays.copyOfRange(array,x+1,array.length);
}
System.out.println(Arrays.deepToString(result));
}
}