### Question:
ArrayOperations { public static double[] padArrayWithZerosToSize(double[] array, int newSize) { assert(newSize >= array.length); double[] paddedArray = new double[newSize]; System.arraycopy(array, 0, paddedArray, 0, array.length); for (int i = array.length; i < paddedArray.length; i++) { paddedArray[i] = 0; } return paddedArray; }  static double[] padArrayWithZerosToSize(double[] array, int newSize); static double[] convolve(double[] array1, double[] array2); static double[] reverse(double[] array); static double[] trimArrayToSize(double[] array, int size); static double[] removeFirstElements(double[] array, int numberOfElements); static Complex[] convertDoubleArrayToComplex(double[] input); static void fillArrayWithValue(double[] array, double value, int startIndex, int endIndex);  }### Answer:
@Test public void testPadWithZeros() { double[] array; double[] paddedArray; array = new double[] {}; paddedArray = ArrayOperations.padArrayWithZerosToSize(array, 0); assertEquals(0, paddedArray.length); paddedArray = ArrayOperations.padArrayWithZerosToSize(array, 2); assertEquals(2, paddedArray.length); assertArrayEquals(new double[] {0.0, 0.0}, paddedArray, 1e-10); array = new double[] {1.0}; paddedArray = ArrayOperations.padArrayWithZerosToSize(array, 1); assertEquals(1, paddedArray.length); assertArrayEquals(new double[] {1.0}, paddedArray, 1e-10); paddedArray = ArrayOperations.padArrayWithZerosToSize(array, 4); assertEquals(4, paddedArray.length); assertArrayEquals(new double[] {1.0, 0.0, 0.0, 0.0}, paddedArray, 1e-10); array = new double[] {1.0, 0.2, 0.3}; paddedArray = ArrayOperations.padArrayWithZerosToSize(array, 5); assertEquals(5, paddedArray.length); assertArrayEquals(new double[] {1.0, 0.2, 0.3, 0.0, 0.0}, paddedArray, 1e-10); array = new double[] {1, 2, 5, 4}; paddedArray = ArrayOperations.padArrayWithZerosToSize(array, 10); assertEquals(10, paddedArray.length); assertArrayEquals(paddedArray, new double[] {1, 2, 5, 4, 0, 0, 0, 0, 0, 0}, 0.01); }