Java tutorial
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; public class Main { public static int compareInt(double valone, double valTwo) { BigDecimal val1 = new BigDecimal(valone); BigDecimal val2 = new BigDecimal(valTwo); int result = -1; if (val1.compareTo(val2) < 0) { result = -1; } if (val1.compareTo(val2) == 0) { result = 0; } if (val1.compareTo(val2) > 0) { result = 1; } return result; } }