Java tutorial
import java.math.BigDecimal; public class Main { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("-999999"); BigDecimal bg2 = new BigDecimal("3.3E+10"); // assign the long value of bg1 and bg2 to l1,l2 respectively long l1 = bg1.longValueExact(); long l2 = bg2.longValueExact(); // print l1,l2 values System.out.println(l1); System.out.println(l2); } }