I get good results for even and odd lengths but it says it's not ok for odd ones.
Anyone can help?
package en.codegym.task.pro.task05.task0516;
import java.util.Arrays;
/*
Filling an array
*/
public class Solution {
public static int[] array = new int[19];
public static int valueStart = 10;
public static int valueEnd = 13;
public static int half = array.length / 2;
public static void main(String[] args) {
//write your code here
if (array.length % 2 == 0) {
Arrays.fill(array, 0, half, valueStart);
Arrays.fill(array, half, array.length , valueEnd);
} else {
Arrays.fill(array, 0, (half + 1), valueStart);
Arrays.fill(array, (half + 1), array.length , valueEnd);
}
System.out.println(Arrays.toString(array));
}
}