### Question:
DiVector { public DiVector scale(double z) { DiVector result = new DiVector(dimensions); for (int i = 0; i < dimensions; i++) { result.high[i] = high[i] * z; result.low[i] = low[i] * z; } return result; } DiVector(int dimensions);  DiVector(DiVector base); static DiVector addToLeft(DiVector left, DiVector right); int getDimensions(); DiVector scale(double z); void renormalize(double targetNorm); void componentwiseTransform(Function<Double, Double> function); double getHighLowSum(int i); double getHighLowSum(); final double[] high; final double[] low; }### Answer:
@Test public void testScale() { vector.high[0] = 1.1; vector.high[2] = 3.1; vector.low[1] = 2.2; double z = 9.9; DiVector result = vector.scale(z); double[] expected = new double[] { 1.1 * 9.9, 0.0, 3.1 * 9.9 }; assertArrayEquals(expected, result.high); expected = new double[] { 0.0, 2.2 * 9.9, 0.0 }; assertArrayEquals(expected, result.low); DiVector emptyVector = new DiVector(dimensions); emptyVector.scale(123.0); expected = new double[dimensions]; assertArrayEquals(expected, emptyVector.low); assertArrayEquals(expected, emptyVector.high); }