Here you can find the source of maxDiffLocation(double[] list1, double[] list2)
Parameter | Description |
---|---|
list1 | a parameter |
list2 | a parameter |
public static int maxDiffLocation(double[] list1, double[] list2)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w . j ava 2 s.c o m * This method finds the largest difference between numbers in the same cell * of the two lists and returns the location where that difference occurs. * The lists must be the same size. * @param list1 * @param list2 * @return the location of the largest difference between values from the same * cell in the two lists */ public static int maxDiffLocation(double[] list1, double[] list2) { int location = 0; double val = (list1[location] - list2[location]); for (int i = 0; i < list1.length; ++i) { if (Math.abs(list1[i] - list2[i]) > val) { location = i; val = Math.abs(list1[i] - list2[i]); } } return location; } }