Java tutorial
//package com.java2s; import java.math.BigDecimal; public class Main { public static int convertDoubleToInt(double sourceNum) { BigDecimal bigDecimal = new BigDecimal(sourceNum); return bigDecimal.setScale(0, BigDecimal.ROUND_HALF_UP).intValue(); } }