Here you can find the source of subtract(double[] p1, double[] p2)
public static double[] subtract(double[] p1, double[] p2)
//package com.java2s; //License from project: Apache License public class Main { public static double[] subtract(double[] p1, double[] p2) { int nd = p1.length; double[] out = new double[nd]; for (int d = 0; d < nd; d++) { out[d] = p1[d] - p2[d];//from www.ja va2 s.c om } return out; } public static double[] subtract(double[] p1, double[] p2, double[] out) { int nd = out.length; for (int d = 0; d < nd; d++) { out[d] = p1[d] - p2[d]; } return out; } }