将第一个数组的每个值与第二个数组的对应值相加。
/** 时代Java - N o w J a v a . c o m **/ //package com.nowjava; public class Main { /** * Adds each value of the first array with the corresponding * value of the second one. */ public static double[] add(double[] first, double[] second) { if (first.length != second.length) { throw new IllegalArgumentException("Dimensions don't match! " + first.length + " != " + second.length); } double[] result = new double[first.length]; for (int i