Java tutorial
import java.math.BigDecimal; public class Main { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("10"); BigDecimal bg2 = new BigDecimal("20"); int res = bg1.compareTo(bg2); // compare bg1 with bg2 String str1 = "Both values are equal "; String str2 = "First Value is greater "; String str3 = "Second value is greater"; if (res == 0) System.out.println(str1); else if (res == 1) System.out.println(str2); else if (res == -1) System.out.println(str3); } }