Here you can find the source of absMax(double[] vector)
private static double absMax(double[] vector)
//package com.java2s; /**//from w w w. j av a 2 s . c o m * Copyright (c) 2011 Michael Kutschke. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Michael Kutschke - initial API and implementation. */ public class Main { /** * * @return the value that differs most from zero */ private static double absMax(double[] vector) { double result = 0; for (double d : vector) { if (d != Double.NEGATIVE_INFINITY && Math.abs(d) > Math.abs(result)) { result = d; } } return result; } }