### Question:
ArrayOperations { public static double[] trimArrayToSize(double[] array, int size) { assert(array.length >= size); double[] trimmedArray = new double[size]; System.arraycopy(array, 0, trimmedArray, 0, size); return trimmedArray; }  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 testTrimArrayToSize() { double[] array = new double[] {1, 2, 3, 4, 5, 6}; assertArrayEquals(ArrayOperations.trimArrayToSize(array, 4), new double[] {1, 2, 3, 4}, 0.001); }