import org.apache.commons.lang.math.NumberUtils;
public class MainClass {
public static void main(String[] args) {
//Compare two double values
System.out.println("(FIRST > SECOND) >>> " +
NumberUtils.compare(2.11, 1.11));
System.out.println("(FIRST < SECOND) >>> " +
NumberUtils.compare(1.11, 2.11));
System.out.println("(FIRST == SECOND) >>> " +
NumberUtils.compare(1.11, 1.11));
}
}
(FIRST > SECOND) >>> 1
(FIRST < SECOND) >>> -1
(FIRST == SECOND) >>> 0
Download: CommonLangNumberUtils.compare.zip( 199 k)