All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.joo.libra.support.NumericComparator Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package org.joo.libra.support;

import java.math.BigDecimal;

/**
 * Utility class for comparing numbers. Both numbers will be converted into
 * BigDecimal before comparing.
 * 
 * @author griever
 *
 */
public class NumericComparator {

	private NumericComparator() {

	}

	public static int compare(final Number one, final Number other) {
		return BigDecimal.valueOf(one.doubleValue()).compareTo(BigDecimal.valueOf(other.doubleValue()));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy